You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To Produce a widget is disposed exception setup a canvas:
create a canvas
add an update listener to the UpdateManager
access the canvas inside listener
dispose canvas after replacing the UpdateManager
More information:
If the widget is disposed after setting the new UpdateManager, the old UpdateManager is not disposed and will execute its pending updates and validations. This will result in a widget is disposed error.
Generally, I don't think disposing the old UpdateManager is a good idea, as we have no idea where else it might be used (perhaps a different LWS?). Instead, I think it's sufficient to simply remove UpdateListener from the old manager to solve this problem.
After a quick glance, I noticed that there is a conceptional problem with replacing the UpdateManager. The UpdateManager is hooked to the FigureCanvas upon creation. But this is only done for the initial manager, meaning that the new UpdateManager won't receive any of the new events and any further updates are lost once the old one is disposed.
A more prudent approach would be to have the LightweightSystem fire an event, whenever the update manager is replaced. The FigureCanvas listens to this event and then updates the listener accordingly. Any listeners added outside Draw2D have to be removed by the client (perhaps even via the same event).
The text was updated successfully, but these errors were encountered:
Based on https://bugs.eclipse.org/bugs/show_bug.cgi?id=250255
Steps To Reproduce:
To Produce a widget is disposed exception setup a canvas:
More information:
If the widget is disposed after setting the new UpdateManager, the old UpdateManager is not disposed and will execute its pending updates and validations. This will result in a widget is disposed error.
Generally, I don't think disposing the old UpdateManager is a good idea, as we have no idea where else it might be used (perhaps a different LWS?). Instead, I think it's sufficient to simply remove UpdateListener from the old manager to solve this problem.
After a quick glance, I noticed that there is a conceptional problem with replacing the UpdateManager. The UpdateManager is hooked to the FigureCanvas upon creation. But this is only done for the initial manager, meaning that the new UpdateManager won't receive any of the new events and any further updates are lost once the old one is disposed.
gef-classic/org.eclipse.draw2d/src/org/eclipse/draw2d/FigureCanvas.java
Lines 262 to 274 in 9974631
A more prudent approach would be to have the LightweightSystem fire an event, whenever the update manager is replaced. The FigureCanvas listens to this event and then updates the listener accordingly. Any listeners added outside Draw2D have to be removed by the client (perhaps even via the same event).
The text was updated successfully, but these errors were encountered: