Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 54911 Details for
Bug 133276
[DND] DropTarget throws exceptions when being disposed of during DND operation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to check for dispose
133276-dispose-patch.txt (text/plain), 13.87 KB, created by
Duong Nguyen
on 2006-12-01 13:48:09 EST
(
hide
)
Description:
Patch to check for dispose
Filename:
MIME Type:
Creator:
Duong Nguyen
Created:
2006-12-01 13:48:09 EST
Size:
13.87 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java,v >retrieving revision 1.42 >diff -u -r1.42 DropTarget.java >--- Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java 21 Nov 2006 20:06:58 -0000 1.42 >+++ Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java 1 Dec 2006 18:38:49 -0000 >@@ -266,6 +266,11 @@ > TransferData[] allowedDataTypes = new TransferData[event.dataTypes.length]; > System.arraycopy(event.dataTypes, 0, allowedDataTypes, 0, allowedDataTypes.length); > notifyListeners(DND.DragEnter, event); >+ if (control == null || control.isDisposed()) { >+ OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4); >+ return COM.S_FALSE; >+ } >+ > refresh(); > if (event.detail == DND.DROP_DEFAULT) { > event.detail = (allowedOperations & DND.DROP_MOVE) != 0 ? DND.DROP_MOVE : DND.DROP_NONE; >@@ -307,7 +312,11 @@ > > iDataObject.Release(); > iDataObject = null; >- return COM.S_OK; >+ >+ if (control == null || control.isDisposed()) >+ return COM.S_FALSE; >+ else >+ return COM.S_OK; > } > > int DragOver(int grfKeyState, int pt_x, int pt_y, int pdwEffect) { >@@ -334,6 +343,10 @@ > event.dataType = selectedDataType; > } > notifyListeners(event.type, event); >+ if (control == null || control.isDisposed()) { >+ OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4); >+ return COM.S_FALSE; >+ } > refresh(); > if (event.detail == DND.DROP_DEFAULT) { > event.detail = (allowedOperations & DND.DROP_MOVE) != 0 ? DND.DROP_MOVE : DND.DROP_NONE; >@@ -369,6 +382,10 @@ > event.item = effect.getItem(pt_x, pt_y); > event.detail = DND.DROP_NONE; > notifyListeners(DND.DragLeave, event); >+ if (control == null || control.isDisposed()){ >+ OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4); >+ return COM.S_FALSE; >+ } > refresh(); > > event = new DNDEvent(); >@@ -385,6 +402,11 @@ > event.dataType = selectedDataType; > event.detail = selectedOperation; > notifyListeners(DND.DropAccept,event); >+ if (control == null || control.isDisposed()){ >+ OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4); >+ return COM.S_FALSE; >+ } >+ > refresh(); > > selectedDataType = null; >@@ -425,6 +447,10 @@ > } finally { > OS.ImageList_DragShowNolock(true); > } >+ if (control == null || control.isDisposed()){ >+ OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4); >+ return COM.S_FALSE; >+ } > refresh(); > selectedOperation = DND.DROP_NONE; > if ((allowedOperations & event.detail) == event.detail) { >Index: Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java,v >retrieving revision 1.34 >diff -u -r1.34 DragSource.java >--- Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java 14 Sep 2006 22:00:10 -0000 1.34 >+++ Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java 1 Dec 2006 18:38:49 -0000 >@@ -319,6 +319,8 @@ > image.dispose(); > } > display.setData(key, oldValue); >+ if (control == null || control.isDisposed()) return; >+ > int operation = osToOp(pdwEffect[0]); > if (dataEffect == DND.DROP_MOVE) { > operation = (operation == DND.DROP_NONE || operation == DND.DROP_COPY) ? DND.DROP_TARGET_MOVE : DND.DROP_MOVE; >@@ -452,6 +454,7 @@ > event.time = OS.GetMessageTime(); > event.dataType = transferData; > notifyListeners(DND.DragSetData,event); >+ if (control == null || control.isDisposed()) return COM.E_FAIL; > > // get matching transfer agent to perform conversion > Transfer transfer = null; >Index: Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java,v >retrieving revision 1.49 >diff -u -r1.49 DropTarget.java >--- Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java 14 Nov 2006 20:55:00 -0000 1.49 >+++ Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java 1 Dec 2006 18:38:49 -0000 >@@ -382,6 +382,11 @@ > event.time = callbackData.timeStamp; > event.detail = DND.DROP_NONE; > notifyListeners(DND.DragLeave, event); >+ if (control == null || control.isDisposed()) { >+ callbackData.dropSiteStatus = (byte)OS.XmDROP_SITE_INVALID; >+ callbackData.operation = opToOsOp(DND.DROP_NONE); >+ OS.memmove(call_data, callbackData, XmDragProcCallbackStruct.sizeof); >+ } > return; > } > >@@ -421,6 +426,13 @@ > > updateDragOverHover(DRAGOVER_HYSTERESIS, event); > notifyListeners(event.type, event); >+ if (control == null || control.isDisposed()) { >+ callbackData.dropSiteStatus = (byte)OS.XmDROP_SITE_INVALID; >+ callbackData.operation = opToOsOp(DND.DROP_NONE); >+ OS.memmove(call_data, callbackData, XmDragProcCallbackStruct.sizeof); >+ return; >+ } >+ > if (event.detail == DND.DROP_DEFAULT) { > event.detail = (allowedOperations & DND.DROP_MOVE) != 0 ? DND.DROP_MOVE : DND.DROP_NONE; > } >@@ -473,6 +485,12 @@ > event.dataType = selectedDataType; > event.detail = selectedOperation; > notifyListeners(DND.DropAccept,event); >+ if (control == null || control.isDisposed()) { >+ // this was not a successful drop >+ int[] args = new int[] {OS.XmNtransferStatus, OS.XmTRANSFER_FAILURE, OS.XmNnumDropTransfers, 0}; >+ dropTransferObject = OS.XmDropTransferStart(droppedEventData.dragContext, args, args.length / 2); >+ return; >+ } > selectedDataType = null; > if (event.dataType != null) { > for (int i = 0; i < allowedDataTypes.length; i++) { >@@ -832,6 +850,11 @@ > int xtContext = OS.XtDisplayToApplicationContext (getDisplay().xDisplay); > OS.XtAppSetSelectionTimeout (xtContext, selectionTimeout); > >+ if (control == null || control.isDisposed()) { >+ selectedOperation = DND.DROP_NONE; >+ return; >+ } >+ > //notify source of action taken > if ((selectedOperation & DND.DROP_MOVE) == DND.DROP_MOVE) { > int[] args = new int[]{control.handle, DELETE_TYPE}; >Index: Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java,v >retrieving revision 1.29 >diff -u -r1.29 DragSource.java >--- Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java 14 Sep 2006 22:29:49 -0000 1.29 >+++ Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java 1 Dec 2006 18:38:49 -0000 >@@ -293,6 +293,7 @@ > //event.time = ??; > event.dataType = transferData; > notifyListeners(DND.DragSetData,event); >+ if (control == null || control.isDisposed()) return 0; > > Transfer transferAgent = null; > for (int i = 0; i < transferAgents.length; i++){ >@@ -332,6 +333,7 @@ > event.doit = true; > event.feedback = DND.FEEDBACK_DEFAULT; > notifyListeners(DND.DragStart, event); >+ if (control == null || control.isDisposed()) return; > if (!event.doit || transferAgents == null || transferAgents.length == 0) { > int time = xEvent.time; > int dc = OS.XmGetDragContext(control.handle, time); >@@ -397,6 +399,7 @@ > } > > int dragDropFinishCallback(int widget, int client_data, int call_data) { >+ if (control == null || control.isDisposed()) return 0; > > // uncomment the following code when we allow users to specify their own source icons > // release the pre set source icon >@@ -414,6 +417,7 @@ > return 0; > } > int dropFinishCallback(int widget, int client_data, int call_data) { >+ if (control == null || control.isDisposed()) return 0; > XmDropFinishCallbackStruct data = new XmDropFinishCallbackStruct(); > OS.memmove(data, call_data, XmDropFinishCallbackStruct.sizeof); > if (data.dropAction != OS.XmDROP || data.dropSiteStatus != OS.XmDROP_SITE_VALID) { >Index: Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java,v >retrieving revision 1.40 >diff -u -r1.40 DragSource.java >--- Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java 14 Sep 2006 22:19:28 -0000 1.40 >+++ Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java 1 Dec 2006 18:38:49 -0000 >@@ -357,7 +357,8 @@ > event.time = time; > event.dataType = transferData; > notifyListeners(DND.DragSetData, event); >- >+ if (control == null || control.isDisposed()) return; >+ > Transfer transfer = null; > for (int i = 0; i < transferAgents.length; i++) { > if (transferAgents[i].isSupportedType(transferData)) { >Index: Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java,v >retrieving revision 1.45 >diff -u -r1.45 DropTarget.java >--- Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java 14 Nov 2006 20:49:45 -0000 1.45 >+++ Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java 1 Dec 2006 18:38:49 -0000 >@@ -390,6 +390,8 @@ > selectedDataType = null; > selectedOperation = DND.DROP_NONE; > notifyListeners(DND.DropAccept,event); >+ if (control == null || control.isDisposed()) return false; >+ > if (event.dataType != null) { > for (int i = 0; i < allowedDataTypes.length; i++) { > if (allowedDataTypes[i].type == event.dataType.type) { >@@ -459,6 +461,11 @@ > selectedDataType = null; > selectedOperation = DND.DROP_NONE; > notifyListeners(event.type, event); >+ if (control == null || control.isDisposed()) { >+ OS.gdk_drag_status(context, 0, time); >+ return false; >+ } >+ > if (event.detail == DND.DROP_DEFAULT) { > event.detail = (allowedOperations & DND.DROP_MOVE) != 0 ? DND.DROP_MOVE : DND.DROP_NONE; > } >Index: Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DropTarget.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DropTarget.java,v >retrieving revision 1.39 >diff -u -r1.39 DropTarget.java >--- Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DropTarget.java 14 Nov 2006 21:19:12 -0000 1.39 >+++ Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DropTarget.java 1 Dec 2006 18:38:49 -0000 >@@ -338,6 +338,7 @@ > event.time = (int)System.currentTimeMillis(); > event.detail = DND.DROP_NONE; > notifyListeners(DND.DragLeave, event); >+ if (control == null || control.isDisposed()) return OS.dragNotAcceptedErr; > > event = new DNDEvent(); > if (!setEventData(theDrag, event)) { >@@ -354,7 +355,8 @@ > selectedDataType = null; > selectedOperation = DND.DROP_NONE; > notifyListeners(DND.DropAccept, event); >- >+ if (control == null || control.isDisposed()) return OS.dragNotAcceptedErr; >+ > if (event.dataType != null) { > for (int i = 0; i < allowedDataTypes.length; i++) { > if (allowedDataTypes[i].type == event.dataType.type) { >@@ -412,6 +414,9 @@ > if ((allowedOperations & event.detail) == event.detail) { > selectedOperation = event.detail; > } >+ if (control == null || control.isDisposed()) { >+ selectedOperation = DND.DROP_NONE; >+ } > //notify source of action taken > int action = opToOsOp(selectedOperation); > OS.SetDragDropAction(theDrag, action); >@@ -432,7 +437,10 @@ > event.time = (int)System.currentTimeMillis(); > event.detail = DND.DROP_NONE; > notifyListeners(DND.DragLeave, event); >- return OS.noErr; >+ if (control == null || control.isDisposed()) >+ return OS.dragNotAcceptedErr; >+ else >+ return OS.noErr; > } > > int oldKeyOperation = keyOperation; >@@ -473,6 +481,11 @@ > selectedDataType = null; > selectedOperation = DND.DROP_NONE; > notifyListeners(event.type, event); >+ if (control == null || control.isDisposed()) { >+ OS.SetDragDropAction(theDrag, opToOsOp(DND.DROP_NONE)); >+ OS.SetThemeCursor(OS.kThemeNotAllowedCursor); >+ return OS.dragNotAcceptedErr; >+ } > > if (event.detail == DND.DROP_DEFAULT) { > event.detail = (allowedOperations & DND.DROP_MOVE) != 0 ? DND.DROP_MOVE : DND.DROP_NONE; >Index: Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DragSource.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DragSource.java,v >retrieving revision 1.37 >diff -u -r1.37 DragSource.java >--- Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DragSource.java 14 Sep 2006 22:29:46 -0000 1.37 >+++ Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DragSource.java 1 Dec 2006 18:38:49 -0000 >@@ -260,6 +260,7 @@ > event.doit = true; > event.feedback = DND.FEEDBACK_DEFAULT; > notifyListeners(DND.DragStart, event); >+ if (control == null || control.isDisposed()) return; > if (!event.doit || transferAgents == null || transferAgents.length == 0) return; > > int[] theDrag = new int[1]; >@@ -286,7 +287,7 @@ > event.time = (int)System.currentTimeMillis(); > event.dataType = transferData; > notifyListeners(DND.DragSetData, event); >- if (event.data == null) return; >+ if (event.data == null || control == null || control.isDisposed()) return; > Transfer transferAgent = transferAgents[i]; > for (int j = 0; j < types.length; j++) { > transferData.type = types[j]; >@@ -363,6 +364,7 @@ > event.time = (int)System.currentTimeMillis(); > event.dataType = transferData; > notifyListeners(DND.DragSetData, event); >+ if (control == null || control.isDisposed()) return OS.badDragFlavorErr; > Transfer transfer = null; > for (int i = 0; i < transferAgents.length; i++) { > if (transferAgents[i].isSupportedType(transferData)) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 133276
: 54911