I have an application that creates DrawImages and attaches them to DrawPanes. These are destroyed and recreated as part of using the app. As of Smart GWT EE 4.1-20160210, I discovered that a JavaScript error is thrown after the DrawImages are destroyed. I tried with the debug version of the models, and get the following stack trace:
ISC_Drawing.js:8971 Uncaught TypeError: Cannot read property 'redrawBitmap' of null
image.onload @ ISC_Drawing.js:8971
This is attached to the onload event of the <img> tag underlying the DrawImage object:
To be transparent, I don't understand why the image is firing a load event after the DrawImage has been destroyed. I was able to verify that the values for self.destroyed and self.destroying are true in the Chrome debugger. Our app code doesn't change the value of src or set the drawPane to null explicitly, so I don't know. However, I was able to correct this with a simple fix:
Any chance a fix like this could be rolled into 4.1? Let me know if I need to provide more detailed code a or a reproduction case.
Key details:
-SmartGWT EE 4.1-20160210
-SmartClient console version: v9.1p_2016-02-10/Enterprise Deployment (built 2016-02-10)
-Browsers where issue was observed:
1. Chrome 49.0.2623.112
2. Internet Explorer 11.212.10586.0
ISC_Drawing.js:8971 Uncaught TypeError: Cannot read property 'redrawBitmap' of null
image.onload @ ISC_Drawing.js:8971
This is attached to the onload event of the <img> tag underlying the DrawImage object:
Code:
image.onload = function () { if (self.drawingBitmap) { self.drawPane.redrawBitmap(); } };
Code:
image.onload = function () { if (self.drawingBitmap [B]&& self["drawPane"][/B] != null) { self.drawPane.redrawBitmap(); } };
Key details:
-SmartGWT EE 4.1-20160210
-SmartClient console version: v9.1p_2016-02-10/Enterprise Deployment (built 2016-02-10)
-Browsers where issue was observed:
1. Chrome 49.0.2623.112
2. Internet Explorer 11.212.10586.0
Comment