Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353823

Summary: SWT Cocoa vm dump
Product: [Eclipse Project] Platform Reporter: Wim Jongman <wim.jongman>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, lshanmug
Version: 3.6.2   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard: stalebug

Description Wim Jongman CLA 2011-08-03 16:34:43 EDT
I came across this when I roll up in a tree when the first item was already visible. Mac the sort of makes an elastic movement showing an empty area above the first item in the tree and the immediately bounces back to show the first time. 

I have paintlistener and in this paintlistener I do this:

try {

				// Stop the sidetable from flickering
				sideTable.setVisible(false);

				// Calculate the current visible top and bottom indices in the
				// main tree.
				int itemHeight = tree.getItemHeight();
				Rectangle clientArea = tree.getClientArea();
				int offset = tree.getTopItem().getBounds().y;		
			} finally {
				sideTable.pack();
				sideTable.setVisible(true);
			}

The call to getTopItem results in an NPE and a subsequent crashing of the complete VM. 

When I check on null from getTopItem everything is ok. Seems like the paintlistener is not happy with uncaught exceptions like this?



java.lang.NullPointerException
	at org.eclipse.ecf.salvo.ui.internal.editor.ArticlePanel$ArticlePanelTreePaintListener.paintControl(ArticlePanel.java:96)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:223)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3783)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1398)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1383)
	at org.eclipse.swt.widgets.Control.drawWidget(Control.java:1131)
	at org.eclipse.swt.widgets.Widget.drawRect(Widget.java:685)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4965)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.scrollClipViewToPoint(Widget.java:1352)
	at org.eclipse.swt.widgets.Scrollable.scrollClipViewToPoint(Scrollable.java:300)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5212)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
	at org.eclipse.swt.widgets.Widget.scrollWheel(Widget.java:1356)
	at org.eclipse.swt.widgets.Control.scrollWheel(Control.java:2206)
	at org.eclipse.swt.widgets.Composite.scrollWheel(Composite.java:987)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5051)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
	at org.eclipse.swt.widgets.Widget.scrollWheel(Widget.java:1356)
	at org.eclipse.swt.widgets.Control.scrollWheel(Control.java:2206)
	at org.eclipse.swt.widgets.Composite.scrollWheel(Composite.java:987)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5051)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
	at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:1959)
	at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2025)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5047)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4589)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:4666)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:115)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3281)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ecf.salvo.application.internal.Application.start(Application.java:33)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
2011-08-03 22:20:44.194 java[12436:407] An uncaught exception was raised
2011-08-03 22:20:44.194 java[12436:407] Java exception occurred
2011-08-03 22:20:44.280 java[12436:407] (
	0   CoreFoundation                      0x00007fff901f5986 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff882a8d5e objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff9027f5a9 -[NSException raise] + 9
	3   libswt-cocoa-3659.jnilib            0x000000011480a008 callback + 1726
	4   libswt-cocoa-3659.jnilib            0x00000001147eb085 fn9_4 + 58
	5   libswt-pi-cocoa-3659.jnilib         0x0000000114832ede proc_CALLBACK_1scrollClipView_1toPoint_1 + 71
	6   AppKit                              0x00007fff89e79bbf -[NSClipView _scrollTo:animateScroll:flashScrollerKnobs:] + 1497
	7   AppKit                              0x00007fff89e7cb7c -[NSClipView _scrollTo:animate:] + 27
	8   AppKit                              0x00007fff8a4b2510 __-[NSScrollView _snapRubberBand]_block_invoke_2 + 1270
	9   AppKit                              0x00007fff8a4255b2 ____NSPeriodicInvokerScheduled_block_invoke_2 + 53
	10  libdispatch.dylib                   0x00007fff8e95e90a _dispatch_call_block_and_release + 18
	11  libdispatch.dylib                   0x00007fff8e960c57 _dispatch_after_timer_callback + 16
	12  libdispatch.dylib                   0x00007fff8e9632f1 _dispatch_source_invoke + 614
	13  libdispatch.dylib                   0x00007fff8e95ffc7 _dispatch_queue_invoke + 71
	14  libdispatch.dylib                   0x00007fff8e960747 _dispatch_main_queue_callback_4CF + 257
	15  CoreFoundation                      0x00007fff9018ac0c __CFRunLoopRun + 1724
	16  CoreFoundation                      0x00007fff9018a216 CFRunLoopRunSpecific + 230
	17  Foundation                          0x00007fff88917983 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 267
	18  libswt-pi-cocoa-3659.jnilib         0x000000011484437e Java_org_eclipse_swt_internal_cocoa_OS_objc_1msgSend_1bool__JJJJ + 58
	19  ???                                 0x0000000109359d6e 0x0 + 4449475950
)
2011-08-03 22:20:44.281 java[12436:407] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Java exception occurred'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff901f5986 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff882a8d5e objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff9027f5a9 -[NSException raise] + 9
	3   libswt-cocoa-3659.jnilib            0x000000011480a008 callback + 1726
	4   libswt-cocoa-3659.jnilib            0x00000001147eb085 fn9_4 + 58
	5   libswt-pi-cocoa-3659.jnilib         0x0000000114832ede proc_CALLBACK_1scrollClipView_1toPoint_1 + 71
	6   AppKit                              0x00007fff89e79bbf -[NSClipView _scrollTo:animateScroll:flashScrollerKnobs:] + 1497
	7   AppKit                              0x00007fff89e7cb7c -[NSClipView _scrollTo:animate:] + 27
	8   AppKit                              0x00007fff8a4b2510 __-[NSScrollView _snapRubberBand]_block_invoke_2 + 1270
	9   AppKit                              0x00007fff8a4255b2 ____NSPeriodicInvokerScheduled_block_invoke_2 + 53
	10  libdispatch.dylib                   0x00007fff8e95e90a _dispatch_call_block_and_release + 18
	11  libdispatch.dylib                   0x00007fff8e960c57 _dispatch_after_timer_callback + 16
	12  libdispatch.dylib                   0x00007fff8e9632f1 _dispatch_source_invoke + 614
	13  libdispatch.dylib                   0x00007fff8e95ffc7 _dispatch_queue_invoke + 71
	14  libdispatch.dylib                   0x00007fff8e960747 _dispatch_main_queue_callback_4CF + 257
	15  CoreFoundation                      0x00007fff9018ac0c __CFRunLoopRun + 1724
	16  CoreFoundation                      0x00007fff9018a216 CFRunLoopRunSpecific + 230
	17  Foundation                          0x00007fff88917983 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 267
	18  libswt-pi-cocoa-3659.jnilib         0x000000011484437e Java_org_eclipse_swt_internal_cocoa_OS_objc_1msgSend_1bool__JJJJ + 58
	19  ???                                 0x0000000109359d6e 0x0 + 4449475950
)
terminate called throwing an exception
Comment 1 Felipe Heidrich CLA 2011-08-04 15:57:12 EDT
could you please post a swt only snippet that reproduces this problem ?

what a version of mac osx are you running ?

I would like to know why this NPE is happening.
Comment 2 Lars Vogel CLA 2019-11-14 03:07:46 EST
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.

If you have further information on the current state of the bug, please add it. 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.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.