Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343816 - NPE when item from the List is dragged
Summary: NPE when item from the List is dragged
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 3.7 RC1   Edit
Assignee: Lakshmi P Shanmugam CLA
QA Contact: Silenio Quarti CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-26 06:29 EDT by Lakshmi P Shanmugam CLA
Modified: 2011-05-02 05:43 EDT (History)
0 users

See Also:
Silenio_Quarti: review+


Attachments
patch (785 bytes, patch)
2011-04-28 10:47 EDT, Lakshmi P Shanmugam CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lakshmi P Shanmugam CLA 2011-04-26 06:29:09 EDT
Cocoa x86_64 : I20110425-1800

1) Run the DNDExample.
2) Select List as the DragSource.
3) Drag any item from the List.
NPE occurs.

Exception in thread "main" java.lang.NullPointerException
	at org.eclipse.swt.widgets.Control.createString(Control.java:965)
	at org.eclipse.swt.widgets.List.tableView_objectValueForTableColumn_row(List.java:1448)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5752)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:722)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5434)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:4864)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5211)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:94)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3596)
	at org.eclipse.swt.examples.dnd.DNDExample.open(DNDExample.java:1352)
	at org.eclipse.swt.examples.dnd.DNDExample.main(DNDExample.java:71)
Comment 1 Lakshmi P Shanmugam CLA 2011-04-28 10:47:47 EDT
Created attachment 194276 [details]
patch

In the DNDExample, list.remove() is called in DragFinished. But, the number of items doesn't get updated in the NSTableView. Hence, tableView_objectValueForTableColumn_row() is called for the removed item causing NPE. 
The patch updates the number of items using noteNumberOfRowsChanged(), when required.

Silenio, can you please review?
Comment 2 Lakshmi P Shanmugam CLA 2011-05-02 05:43:37 EDT
Fixed in HEAD > 20110502.
Thanks Silenio.