fredsa / gwt-dnd

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

NullPointerException when clicking a draggable widget #129

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of GWT are you using? 1.3.3? 1.4.60? Other?
2.0.4

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 (I could test Windows and Linux as well if required)

Does the issue occur in web mode, hosted mode, both or don't know?
both
Firefox: hosted mode only
Google Chrome: occurs in web mode (hosted mode not tested)
Safari: same as Google Chrome but different stack trace

What browser(s) do you use? Firefox, IE, Safari, other?
Firefox, Chrome, Safari

What is the browser version (if you know) from Help->About?
Firefox 3.6.10, Chrome 6.0.472, Safari 5.0.2

What steps will reproduce the problem? Please attach sample code if you
can.
Two panels, each contain images. The images become draggables and the the 
panels drop targets.
1. Adding Image to a dragController: dragController.makeDraggable(widget);
2. Widget extending Composite and implementing DropController is representing a 
panel and becomes a drag target: 
dragController.registerDropController(dropController);
3. If I now click "quickly" on an Image, i.e. not moving, only picking up and 
dropping it right away, I get a NullPointerException (stack trace below)

What is the expected output? What do you see instead?
I would expect the image to be dropped in the same place as picked up. Ideally, 
a click should not initialize a dnd operation at all.

Do you have a workaround?
It seems unproblematic to simply ignore the NullPointerExceptions as they do 
not seem to cause any harm to the interface.

Please provide any additional information below.

Relevant stack trace in Firefox in hosted mode:
Uncaught exception: java.lang.NullPointerException
    at com.allen_sauer.gwt.dnd.client.MouseDragHandler.doSelectionToggle(MouseDragHandler.java:325)
    at com.allen_sauer.gwt.dnd.client.MouseDragHandler.onMouseUp(MouseDragHandler.java:262)
    at com.google.gwt.event.dom.client.MouseUpEvent.dispatch(MouseUpEvent.java:54)
...

Chrome web mode stack trace (URL partially replaced by ***):
Uncaught exception: com.google.gwt.core.client.JavaScriptException: 
(TypeError): Cannot read property 'dragable' of null
 stack: TypeError: Cannot read property 'dragable' of null
    at $doSelectionToggle (http://***/9FAC1F413ABF845CDB526F9B2333D61A.cache.html:282:79)
    at Object.onMouseUp (http://***/9FAC1F413ABF845CDB526F9B2333D61A.cache.html:463:29)
    at Object.dispatch_6 [as dispatch] (http://***/9FAC1F413ABF845CDB526F9B2333D61A.cache.html:3832:23)
    at $fireEvent_0 (http://***/9FAC1F413ABF845CDB526F9B2333D61A.cache.html:4156:15)
    at $fireEvent (http://***/9FAC1F413ABF845CDB526F9B2333D61A.cache.html:4022:5)
    at $fireEvent_2 (http://***/9FAC1F413ABF845CDB526F9B2333D61A.cache.html:7698:35)
    at fireNativeEvent (http://***/9FAC1F413ABF845CDB526F9B2333D61A.cache.html:3506:7)
    at $onBrowserEvent (http://***/9FAC1F413ABF845CDB526F9B2333D61A.cache.html:7726:3)
    at Object.onBrowserEvent (http://***/9FAC1F413ABF845CDB526F9B2333D61A.cache.html:7814:3)
    at dispatchEvent_0 (http://***/9FAC1F413ABF845CDB526F9B2333D61A.cache.html:6000:12)
 type: non_object_property_load
 arguments: dragable,
    at Unknown.$doSelectionToggle(Unknown source:0)
    at Unknown.onMouseUp(Unknown source:0)
    at Unknown.dispatch_6(Unknown source:0)
    at Unknown.$fireEvent_0(Unknown source:0)
    at Unknown.$fireEvent(Unknown source:0)
    at Unknown.$fireEvent_2(Unknown source:0)
    at Unknown.fireNativeEvent(Unknown source:0)
    at Unknown.$onBrowserEvent(Unknown source:0)
    at Unknown.onBrowserEvent(Unknown source:0)
    at Unknown.dispatchEvent_0(Unknown source:0)

Safari web mode stack trace (URL partially replaced by ***):
Uncaught exception: com.google.gwt.core.client.JavaScriptException: 
(TypeError): Result of expression 
'dynamicCast($get_2(this$static.dragHandleMap, mouseDownWidget), 39)' [null] is 
not an object.
 line: 282
 sourceId: 4668858152
 sourceURL: http://***/9FAC1F413ABF845CDB526F9B2333D61A.cache.html
 expressionBeginOffset: 9932
 expressionCaretOffset: 9999
 expressionEndOffset: 10008

Original issue reported on code.google.com by Sven.Bus...@gmail.com on 15 Oct 2010 at 2:25

GoogleCodeExporter commented 9 years ago
Can you provide a small code sample to reproduce this?

Original comment by fredsa@google.com on 20 Oct 2010 at 10:26

GoogleCodeExporter commented 9 years ago

Original comment by fredsa on 31 Jan 2012 at 6:01

GoogleCodeExporter commented 9 years ago
I was able to get around this exception by using a DeferredSchedule command

Original comment by kinshuk....@gmail.com on 1 Feb 2012 at 1:57