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

Bug 361530

Summary: [Mac] Eclipse crashes while creating folder in Browse dialog
Product: [Eclipse Project] Platform Reporter: Praveen <pinnamur>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: amharrison, eclipse.felipe, eclipse, lshanmug, Silenio_Quarti
Version: 3.7   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Crash Log none

Description Praveen CLA 2011-10-20 08:11:57 EDT
Created attachment 205615 [details]
Crash Log

Steps to Reproduce :

1) Right click on Project -> Export -> File System
2) Click Browse button.
3) Click on any location on sidebar (for example - Desktop) and create New Folder
4) Click on 'New Folder' - enter any name quickly and press OK.

It might take around 5 attempts with repeating steps 2-4 to reproduce the crash.

Here is the excerpt of the stack trace -
-------------------------
org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Lorg/eclipse/swt/internal/cocoa/objc_super;IIIIZ)I
org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(IIIIII)I
org.eclipse.swt.widgets.Display.applicationProc(IIIIII)I
v  ~StubRoutines::call_stub
org.eclipse.swt.internal.cocoa.OS.objc_msgSend(IIII)I
org.eclipse.swt.internal.cocoa.NSSavePanel.runModalForDirectory(Lorg/eclipse/swt/internal/cocoa/NSString;Lorg/eclipse/swt/internal/cocoa/NSString;)I+31
org.eclipse.swt.widgets.DirectoryDialog.open()Ljava/lang/String;+210
-------------------------

The crash log file is attached.
Comment 1 Graham Mising name CLA 2011-10-22 11:44:05 EDT
I got this bug too, but not in using Eclipse, but rather in using SWT framework in my Application.  Here's the code to reproduce:

DirectoryDialog newLocationDialog = new DirectoryDialog(shell);
newLocationContainer[0] = newLocationDialog.open();

This was executed inside a Display.syncExec(), hence the array storing the return value of DirectoryDialog.open().

Stack trace:
-------------------------
j  org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Lorg/eclipse/swt/internal/cocoa/objc_super;JJJJZ)J+0
j  org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(JJJJJJ)J+77
j  org.eclipse.swt.widgets.Display.applicationProc(JJJJJJ)J+93
v  ~StubRoutines::call_stub
j  org.eclipse.swt.internal.cocoa.OS.objc_msgSend(JJJJJZ)J+0
j  org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(JLorg/eclipse/swt/internal/cocoa/NSDate;Lorg/eclipse/swt/internal/cocoa/NSString;Z)Lorg/eclipse/swt/internal/cocoa/NSEvent;+36
j  org.eclipse.swt.widgets.Display.readAndDispatch()Z+98
j  org.eclipse.jface.operation.ModalContext$ModalContextThread.block()V+19
j  org.eclipse.jface.operation.ModalContext.run(Lorg/eclipse/jface/operation/IRunnableWithProgress;ZLorg/eclipse/core/runtime/IProgressMonitor;Lorg/eclipse/swt/widgets/Display;)V+131
j  org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ZZLorg/eclipse/jface/operation/IRunnableWithProgress;)V+30
-------------------------

Machine:
Mac OS X 10.7.2 running 64-bit VM.

My analysis:
During the open() call, it makes a call to -[NSSavePanel runModalForDirectory:file:].  This selector is not blocking on the dialog.  The dialog never opens.  Furthermore, this selector is deprecated,  and has been since 10.6.  The documentation suggests calling -runModal instead, which has been available since 10.0, combined with setDirectory: or setDirectoryURL: (the latter is only available in 10.6, the former is deprecated in 10.6)
Comment 2 Graham Mising name CLA 2011-10-22 11:51:04 EDT
Just tried a workaround that works:
if I call newLocationDialog.setFilterPath(path); before open, the crash doesn't seem to occur.  The string path is non-null, has length, but is a path that doesn't exist on the file system.
Comment 3 Lakshmi P Shanmugam CLA 2012-08-06 04:39:41 EDT
This looks same as Bug 364116, and is fixed in 3.8.

*** This bug has been marked as a duplicate of bug 364116 ***