Created
August 6, 2010 14:19
-
-
Save opichals/511374 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 6ace654dac086185c8158e341887dd929c7c234a Mon Sep 17 00:00:00 2001 | |
From: Standa Opichal <[email protected]> | |
Date: Fri, 6 Aug 2010 15:29:44 +0200 | |
Subject: [PATCH 3/3] Avoid touching the s.rawNode internals in destroy() and rather keep the _nodeName in the dojox.gfx.Surface instance to remove the surfaces[] entry. | |
This avoid SL crashing in case the holding DOM node is not in the document or is hidden at the time in which case it would report invalidObject error. | |
--- | |
gfx/silverlight.js | 11 ++++++----- | |
1 files changed, 6 insertions(+), 5 deletions(-) | |
diff --git a/gfx/silverlight.js b/gfx/silverlight.js | |
index ce3be25..9190b4e 100644 | |
--- a/gfx/silverlight.js | |
+++ b/gfx/silverlight.js | |
@@ -504,7 +504,7 @@ dojo.declare("dojox.gfx.Surface", dojox.gfx.shape.Surface, { | |
}, | |
destroy: function(){ | |
window[this._onLoadName] = dojox.gfx.silverlight.nullFunc; | |
- delete dojox.gfx.silverlight.surfaces[this.rawNode.name]; | |
+ delete dojox.gfx.silverlight.surfaces[this._nodeName]; | |
this.inherited(arguments); | |
}, | |
setDimensions: function(width, height){ | |
@@ -548,16 +548,17 @@ dojox.gfx.createSurface = function(parentNode, width, height){ | |
height = height + "px"; | |
} | |
+ var nodeName = dojox.gfx._base._getUniqueId(); | |
var s = new dojox.gfx.Surface(); | |
parentNode = dojo.byId(parentNode); | |
+ s._nodeName = nodeName; | |
s._parent = parentNode; | |
// create an empty canvas | |
var t = parentNode.ownerDocument.createElement("script"); | |
t.type = "text/xaml"; | |
t.id = dojox.gfx._base._getUniqueId(); | |
- t.text = "<?xml version='1.0'?><Canvas xmlns='http://schemas.microsoft.com/client/2007' Name='" + | |
- dojox.gfx._base._getUniqueId() + "'/>"; | |
+ t.text = "<?xml version='1.0'?><Canvas xmlns='http://schemas.microsoft.com/client/2007' Name='" + nodeName + "'/>"; | |
parentNode.parentNode.insertBefore(t, parentNode); | |
s._nodes.push(t); | |
@@ -570,7 +571,7 @@ dojox.gfx.createSurface = function(parentNode, width, height){ | |
if(!s.rawNode){ | |
s.rawNode = dojo.byId(pluginName).content.root; | |
// register the plugin with its parent node | |
- dojox.gfx.silverlight.surfaces[s.rawNode.name] = parentNode; | |
+ dojox.gfx.silverlight.surfaces[nodeName] = parentNode; | |
s.onLoad(s); | |
console.log("Silverlight: assigned"); | |
} | |
@@ -603,7 +604,7 @@ dojox.gfx.createSurface = function(parentNode, width, height){ | |
// the plugin was created synchronously | |
s.rawNode = pluginNode.content.root; | |
// register the plugin with its parent node | |
- dojox.gfx.silverlight.surfaces[s.rawNode.name] = parentNode; | |
+ dojox.gfx.silverlight.surfaces[nodeName] = parentNode; | |
}else{ | |
// the plugin is being created asynchronously | |
s.rawNode = null; | |
-- | |
1.7.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment