WorldWindJava icon indicating copy to clipboard operation
WorldWindJava copied to clipboard

BasicDragger: Added null checks DRAG_END case

Open dr3amr2 opened this issue 8 years ago • 4 comments
trafficstars

I was running into some issues with the dragContext being null when a drag event ended. It gave a bunch of NPE and made my program unresponsive. This was my fix for it.

dr3amr2 avatar Jan 12 '17 18:01 dr3amr2

Can you provide more detail on the conditions under which this happens? It's a trivial change but we'd like to understand what's going on.

pdavidc avatar Jan 12 '17 18:01 pdavidc

RaptorX uses one WWSelectListener to handle all of the dragging, and we're using different types of map object that triggers the dragging. The simpler map objects (2D shapes, UserFacingIcon, etc) where we can implement the Movable, Draggable interfaces works without any issues. While the more custom one like Range Rings and 3D Shapes, has a lot going on where we have to intercept the listener to re-render certain things. These classes does not have the Movable/Dragable interfaces, so the dragContext was never initialized for the BasicDragger. This causes some issues when the BasicDragger class gets called to end a drag event, but the dragContext was null.

Sorry the issues was pretty convoluted, hopefully my comment makes some sense. Let me know if you need additional information.

dr3amr2 avatar Jan 12 '17 18:01 dr3amr2

Thanks, @dr3amr2. We always appreciate getting the background and context behind an issue; your description absolutely makes sense.

pdavidc avatar Jan 12 '17 18:01 pdavidc

Awesome, I'm glad that my comment was somewhat coherent.

Thanks for being quick on reviewing this @pdavidc

dr3amr2 avatar Jan 12 '17 18:01 dr3amr2