Commit cc031e0a authored by olau@iola.dk's avatar olau@iola.dk

Fix possible excanvas leak (report and suggested fix by tom9729)

git-svn-id: https://flot.googlecode.com/svn/trunk@284 1e0a6537-2640-0410-bfb7-f154510ff394
parent a1f56d5b
...@@ -111,7 +111,9 @@ Bug fixes: ...@@ -111,7 +111,9 @@ Bug fixes:
- Listen for mouseleave events and fire a plothover event with empty - Listen for mouseleave events and fire a plothover event with empty
item when it occurs to drop highlights when the mouse leaves the item when it occurs to drop highlights when the mouse leaves the
plot (reported by by outspirit). plot (reported by by outspirit).
- Fix bug with using aboveData with a background (reported by amitayd). - Fix bug with using aboveData with a background (reported by
amitayd).
- Fix possible excanvas leak (report and suggested fix by tom9729).
Flot 0.6 Flot 0.6
......
...@@ -699,15 +699,28 @@ ...@@ -699,15 +699,28 @@
function constructCanvas() { function constructCanvas() {
canvasWidth = placeholder.width(); canvasWidth = placeholder.width();
canvasHeight = placeholder.height(); canvasHeight = placeholder.height();
// excanvas hack, if there are any canvases here, whack
// the state on them manually
if (window.G_vmlCanvasManager)
placeholder.find("canvas").each(function () {
delete this.context_;
});
placeholder.html(""); // clear placeholder placeholder.html(""); // clear placeholder
if (placeholder.css("position") == 'static') if (placeholder.css("position") == 'static')
placeholder.css("position", "relative"); // for positioning labels and overlay placeholder.css("position", "relative"); // for positioning labels and overlay
if (canvasWidth <= 0 || canvasHeight <= 0) if (canvasWidth <= 0 || canvasHeight <= 0)
throw "Invalid dimensions for plot, width = " + canvasWidth + ", height = " + canvasHeight; throw "Invalid dimensions for plot, width = " + canvasWidth + ", height = " + canvasHeight;
if (window.G_vmlCanvasManager) // excanvas hack, make sure everything is setup // excanvas hack, make sure everything is setup
if (window.G_vmlCanvasManager
&& !window.G_vmlCanvasManager.inited) {
window.G_vmlCanvasManager.inited = true;
window.G_vmlCanvasManager.init_(document); window.G_vmlCanvasManager.init_(document);
}
function makeCanvas(skipPositioning) { function makeCanvas(skipPositioning) {
var c = document.createElement('canvas'); var c = document.createElement('canvas');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment