Bug 233784 - FigureCanvas scrollToX and scrollToY may cause SWTException due to disposed widget
Summary: FigureCanvas scrollToX and scrollToY may cause SWTException due to disposed w...
Status: RESOLVED FIXED
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy Draw2d (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4.0 (Ganymede) RC3   Edit
Assignee: Anthony Hunter CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-05-23 21:12 EDT by Chris Lee CLA
Modified: 2008-09-18 13:47 EDT (History)
2 users (show)

See Also:


Attachments
patch for this bug (1.25 KB, patch)
2008-05-23 21:29 EDT, Chris Lee CLA
ahunter.eclipse: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lee CLA 2008-05-23 21:12:38 EDT
Build ID:  I20080502-0100

Steps To Reproduce:
- We have some EditParts that host other Composites embedded on the page, which get disposed of when they scroll offscreen. (There are potentially a very large number of these, so we only maintain the Composite while it is on screen)
- the scrollToX and scrollToY functions in FigureCanvas do something like this:

Control[] children = getChildren ();
iterate over children to calculate manualMove
scroll (x,y,x,y,w,h,true);
iterate over children again, setting bounds

The issue is that during the call to scroll, paint gets called, which may trigger the disposal of the child composite.


More information:
I think that there's an easy fix for this, basically to just check if the control is disposed before doing anything with the widget in the second part of the function.

This should not have any negative effect on existing things that use this code, and will avoid the FigureCanvas trying to do things with disposed controls.

I will submit a patch to cover this scenario - we'd really like to get this patch in for 3.4...
Comment 1 Chris Lee CLA 2008-05-23 21:29:16 EDT
Created attachment 101843 [details]
patch for this bug

patch to check for child disposal after call to scroll (which may change the disposed state)
Comment 2 Chris Lee CLA 2008-05-28 20:57:35 EDT
*ping*

Can this patch get into 3.4? It should be very safe and low risk. 

(Sorry to drag you in Randy, but we need somebody to at least look at this while it is still early enough to accept this patch...)

It's an issue that basically blocks one of our features...
Comment 3 Anthony Hunter CLA 2008-05-29 09:51:04 EDT
Committed to HEAD.