fredsa / gwt-dnd

Library providing easy to use mouse or touch based drag-and-drop capabilities to GWT
43 stars 41 forks source link

AbstractDragController has a memory leak if makeNotDraggable is not called #139

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Does the issue occur in "quirks mode", "standards mode" or both? If you
don't know, does your HTML page contains a DOCTYPE declaration? Both

What version of GWT are you using? 1.4.60? 2.0.4? Other? 2.1.1

What version of the gwt-dnd jar file or library file are you using?  3.0.1

What operating system(s) are you using? Windows? Linux? Mac? Mac

Does the issue occur in web mode, development mode (formerly "hosted
mode"), both or don't know? Both

AbstractDragController has the following:
   private static HashMap<Widget, Widget> dragHandles = new HashMap<Widget, Widget>();

makeDraggable adds to this map, while makeNotDraggable removes from it. If 
makeNotDraggable is not called, which the documentation never says is required 
for proper cleanup, the dragged Widget, the drag handle,  and everything 
associated with them will never be garbage collected.

Do you have a workaround?

Be sure to always call makeNotDraggable.

I don't see any reason why this Map is static. If it were an instance method, 
and people took care that the DragController went out of scope properly (which 
would be the case with a typical use-case), there would be no reason to 
explicitly call makeNotDraggable, unless that's the behavior you're looking for.

Original issue reported on code.google.com by amirkash...@gmail.com on 18 Jan 2011 at 3:38

GoogleCodeExporter commented 9 years ago
This issue was closed by revision c347087f91d4.

Original comment by fredsa@google.com on 31 Jan 2012 at 6:34