Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » [Cocoa] RuntimeException in SWT listener hangs everything
icon5.gif  [Cocoa] RuntimeException in SWT listener hangs everything [message #526618] Mon, 12 April 2010 12:51 Go to next message
Christophe Fondacci is currently offline Christophe FondacciFriend
Messages: 95
Registered: July 2009
Location: Paris
Member
Hello,

I'm facing a strange problems with SWT for Cocoa.

Here it is :
I have a Tree component.
I add a listener to this tree with :
tree.addListener(SWT.MouseDoubleClick, this);

In my handleEvent method, it seems like whenever a RuntimeException is raised, my environment gets completely "locked".

When this happens, SWT "thread-0" has the stack shown at the end of this message. The same code running on SWT-win32 or on swt-gtk works without any problem.

For now, I need to try catch every implementation of handleEvent to make it robust against cocoa-swt.

Is it a normal behaviour, is it a known bug or may I open a new one ?

Thank you.
Christophe
http://www.nextep-softwares.com

Stack :
Daemon Thread [Thread-0] (Suspended)	
	OS.objc_msgSendSuper(objc_super, int, int) line: not available [native method]	
	Tree(Widget).callSuper(int, int, int) line: 202	
	Tree(Widget).mouseDown(int, int, int) line: 920	
	Tree(Control).mouseDown(int, int, int) line: 2160	
	Tree.mouseDown(int, int, int) line: 1914	
	Display.windowProc(int, int, int) line: 4653	
	OS.objc_msgSendSuper(objc_super, int, int) line: not available [native method]	
	Shell(Widget).callSuper(int, int, int) line: 202	
	Shell(Widget).windowSendEvent(int, int, int) line: 1753	
	Shell.windowSendEvent(int, int, int) line: 1825	
	Display.windowProc(int, int, int) line: 4713	
	OS.objc_msgSendSuper(objc_super, int, int) line: not available [native method]	
	Display.applicationSendEvent(int, int, int) line: 4285	
	Display.applicationProc(int, int, int) line: 4352	
	OS.objc_msgSend(int, int, int) line: not available [native method]	
	NSApplication.sendEvent(NSEvent) line: 101	
	Display.readAndDispatch() line: 3097	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2405	
	Workbench.runUI() line: 2369	
	Workbench.access$4(Workbench) line: 2221	
	Workbench$5.run() line: 500	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 493	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	Application.start(IApplicationContext) line: 27	
	EclipseAppHandle.run(Object) line: 194	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 368	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	Main.invokeFramework(String[], URL[]) line: 559	
	Main.basicRun(String[]) line: 514	
	Main.run(String[]) line: 1311	
	Main.main(String[]) line: 1287	
Re: [Cocoa] RuntimeException in SWT listener hangs everything [message #526643 is a reply to message #526618] Mon, 12 April 2010 13:17 Go to previous messageGo to next message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
Hi Christophe,

normally all listener exceptions should bubble up to the event loop and be handled by the
workbench. Looks like a bug to me, can be reproduced by:

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;

public class SnippetTreeDoubleClickHang {

public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
final Tree tree = new Tree(shell, SWT.BORDER);
for (int i = 0; i < 4; i++) {
TreeItem iItem = new TreeItem(tree, 0);
iItem.setText("TreeItem (0) -" + i);
}

tree.addListener(SWT.MouseDoubleClick, new Listener() {

@Override
public void handleEvent(Event event) {
throw new RuntimeException();
}

});

shell.setSize(200, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}

- Ralf


--
Read my Blog here: http://www.ralfebert.de/blog/
Follow me on Twitter here: http://twitter.com/ralfebert/
Re: [Cocoa] RuntimeException in SWT listener hangs everything [message #526669 is a reply to message #526643] Mon, 12 April 2010 14:43 Go to previous message
Christophe Fondacci is currently offline Christophe FondacciFriend
Messages: 95
Registered: July 2009
Location: Paris
Member

That was my feeling too...
Thanks for the feedback and for having extracted a short snippet from my inputs.

I opened a bug :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=308844

And added the snippet in it (with copyrights Smile )

Regards,
Christophe

http://www.nextep-softwares.com
Previous Topic:SWT Browser problem
Next Topic:TreeItem setBackGround() not working....
Goto Forum:
  


Current Time: Tue Aug 20 13:54:00 GMT 2019

Powered by FUDForum. Page generated in 0.01685 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top