| Summary: | [DND] DropTarget throws exceptions when being disposed of during DND operation | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Florian Priester <fwp> | ||||
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | Kevin Barnes <cocoakevin> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | duongn, snorthov, veronika_irvine | ||||
| Version: | 3.2 | Keywords: | triaged | ||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | stalebug | ||||||
| Attachments: |
|
||||||
Thanks Florian - an excellent bug report as usual. Fixed for this week's milestone build. fixed Verified with the latest SWT from CVS. Out of curiosity, I also checked what happened when the dispose() call is made from any of the other methods of DropTargetListener. -dragLeave: When the data is dropped (without leaving the target area), the following exception occurs: Exception in thread "main" org.eclipse.swt.SWTException: Widget is disposed at org.eclipse.swt.SWT.error(SWT.java:3374) at org.eclipse.swt.SWT.error(SWT.java:3297) at org.eclipse.swt.SWT.error(SWT.java:3268) at org.eclipse.swt.widgets.Widget.error(Widget.java:432) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:327) at org.eclipse.swt.widgets.Widget.getStyle(Widget.java:598) at org.eclipse.swt.dnd.DropTarget.setEventData(DropTarget.java:585) at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:375) at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:238) at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1879) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2964) -dropAccept: This results in another NPE: Exception in thread "main" java.lang.NullPointerException at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:408) at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:238) at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1879) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2964) Reopening since you might want to fix these cases too. Clearing stale milestone. Created attachment 54911 [details]
Patch to check for dispose
Steve, can you verify this patch. Thanks.
This is a one-off bulk update. (The last one in the triage migration). Moving bugs from swt-triaged@eclipse to platform-swt-inbox@eclipse.org and adding "triaged" keyword as per new triage process: https://wiki.eclipse.org/SWT/Devel/Triage See Bug 518478 for details. Tag for notification/mail filters: @TriageBulkUpdate This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
SWT-win32, v3229 When a drop target is disposed of in DropTargetListener.drop, the following exception is thrown: Exception in thread "main" java.lang.NullPointerException at org.eclipse.swt.dnd.DropTarget.refresh(DropTarget.java:545) at org.eclipse.swt.dnd.DropTarget.Drop(DropTarget.java:427) at org.eclipse.swt.dnd.DropTarget$3.method6(DropTarget.java:238) at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1879) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2964) This is a recent regression. --- import org.eclipse.swt.dnd.*; import org.eclipse.swt.widgets.*; public class DropTargetTest { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Drop some text on the shell"); final DropTarget target = new DropTarget( shell, DND.DROP_DEFAULT | DND.DROP_COPY); final TextTransfer transfer = TextTransfer.getInstance(); target.setTransfer(new Transfer[] {transfer}); target.addDropListener(new DropTargetAdapter() { public void dragEnter(DropTargetEvent event) { event.detail = DND.DROP_COPY; } public void drop(DropTargetEvent event) { if (transfer.isSupportedType(event.currentDataType)) { target.dispose(); } } }); shell.setSize(400, 400); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }