Project: SWT
Bug 45341 FileDialog crashes VM on invalid drive
Reported: 2003-10-21 19:05:43 | Status: resolved fixed

The FileDialog widget crashes the VM on Windows XP when the SWT.MULTI style is used and you type in a drive and path that is not accessible. The crash does not occur the first time the dialog is displayed. Most of the time it happens on the second, third, or fourth time the dialog is displayed. To reproduce: 1) Run the program below 2) Click on the "Press me" button 3) Type in d:\temp (where d: is my DVD drive with no DVD in it) 4) Get "Insert Disk" prompt. Press "Cancel" button 5) Repeat steps 1-4 several times until crash occurs If the style is specified only as SWT.OPEN (MULTI is left off), I cannot reproduce the problem. See the following code: public class Bogus { public static void main(String[] args) { final Shell shell = new Shell(); shell.setLayout(new GridLayout(1, false)); Button button = new Button(shell, SWT.NONE); button.setText("Press me"); button.addSelectionListener(new SelectionAdapter(){ public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI); dialog.open(); } }); shell.open(); Display display = shell.getDisplay(); while (shell != null && !shell.isDisposed() && shell.isVisible ()) { if (!display.readAndDispatch()) display.sleep(); } } } Here is the VM crash data: An unexpected exception has been detected in native code outside the VM. Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x70A71A37 Function=PathFindExtensionW+0xA Library=C:\WINDOWS\system32\SHLWAPI.dll Current Java thread: at org.eclipse.swt.internal.win32.OS.GetOpenFileNameW(Native Method) at org.eclipse.swt.internal.win32.OS.GetOpenFileName(OS.java:1489) at org.eclipse.swt.widgets.FileDialog.open(FileDialog.java:263) at Bogus$1.widgetSelected(Bogus.java:31) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:840) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1838) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1545) at Bogus.main(Bogus.java:40) Dynamic libraries: 0x00400000 - 0x00407000 C:\j2sdk1.4.2\bin\javaw.exe 0x77F50000 - 0x77FF7000 C:\WINDOWS\System32\ntdll.dll 0x77E60000 - 0x77F46000 C:\WINDOWS\system32\kernel32.dll 0x77DD0000 - 0x77E5D000 C:\WINDOWS\system32\ADVAPI32.dll 0x78000000 - 0x78086000 C:\WINDOWS\system32\RPCRT4.dll 0x77D40000 - 0x77DC6000 C:\WINDOWS\system32\USER32.dll 0x77C70000 - 0x77CB0000 C:\WINDOWS\system32\GDI32.dll 0x77C10000 - 0x77C63000 C:\WINDOWS\system32\MSVCRT.dll 0x08000000 - 0x08136000 C:\j2sdk1.4.2\jre\bin\client\jvm.dll 0x76B40000 - 0x76B6C000 C:\WINDOWS\System32\WINMM.dll 0x10000000 - 0x10007000 C:\j2sdk1.4.2\jre\bin\hpi.dll 0x00830000 - 0x0083E000 C:\j2sdk1.4.2\jre\bin\verify.dll 0x00840000 - 0x00858000 C:\j2sdk1.4.2\jre\bin\java.dll 0x00860000 - 0x0086D000 C:\j2sdk1.4.2\jre\bin\zip.dll 0x03250000 - 0x03297000 C:\development\dogfood\bin\swt-win32-2133.dll 0x771B0000 - 0x772D1000 C:\WINDOWS\system32\ole32.dll 0x71950000 - 0x71A34000 C:\WINDOWS\WinSxS\X86_Microsoft.Windows.Common- Controls_6595b64144ccf1df_6.0.10.0_x-ww_f7fb5805\COMCTL32.dll 0x70A70000 - 0x70AD4000 C:\WINDOWS\system32\SHLWAPI.dll 0x763B0000 - 0x763F5000 C:\WINDOWS\system32\comdlg32.dll 0x773D0000 - 0x77BC2000 C:\WINDOWS\system32\SHELL32.dll 0x77120000 - 0x771AB000 C:\WINDOWS\system32\OLEAUT32.dll 0x76390000 - 0x763AC000 C:\WINDOWS\System32\IMM32.dll 0x5AD70000 - 0x5ADA4000 C:\WINDOWS\System32\UxTheme.dll 0x75F40000 - 0x75F5F000 C:\WINDOWS\system32\appHelp.dll 0x76FD0000 - 0x77048000 C:\WINDOWS\System32\CLBCATQ.DLL 0x77050000 - 0x77115000 C:\WINDOWS\System32\COMRes.dll 0x77C00000 - 0x77C07000 C:\WINDOWS\system32\VERSION.dll 0x76620000 - 0x7666E000 C:\WINDOWS\System32\cscui.dll 0x76600000 - 0x7661B000 C:\WINDOWS\System32\CSCDLL.dll 0x03540000 - 0x0362D000 C:\Program Files\TortoiseCVS\TrtseShl.dll 0x55900000 - 0x55961000 C:\WINDOWS\System32\MSVCP60.dll 0x76670000 - 0x76757000 C:\WINDOWS\System32\SETUPAPI.dll 0x76990000 - 0x769B4000 C:\WINDOWS\System32\ntshrui.dll 0x76B20000 - 0x76B35000 C:\WINDOWS\System32\ATL.DLL 0x71C20000 - 0x71C6E000 C:\WINDOWS\System32\NETAPI32.dll 0x75A70000 - 0x75B15000 C:\WINDOWS\system32\USERENV.dll 0x71700000 - 0x71849000 C:\WINDOWS\System32\shdocvw.dll 0x037B0000 - 0x038C3000 C:\Program Files\Apoint\Apoint.DLL 0x03750000 - 0x0375F000 C:\WINDOWS\System32\Vxdif.dll 0x038E0000 - 0x038F3000 C:\Program Files\Dell\QuickSet\dadkeyb.dll 0x71B20000 - 0x71B31000 C:\WINDOWS\system32\MPR.dll 0x75F60000 - 0x75F66000 C:\WINDOWS\System32\drprov.dll 0x71C10000 - 0x71C1D000 C:\WINDOWS\System32\ntlanman.dll 0x71CD0000 - 0x71CE6000 C:\WINDOWS\System32\NETUI0.dll 0x71C90000 - 0x71CCC000 C:\WINDOWS\System32\NETUI1.dll 0x71C80000 - 0x71C86000 C:\WINDOWS\System32\NETRAP.dll 0x71BF0000 - 0x71C01000 C:\WINDOWS\System32\SAMLIB.dll 0x75F70000 - 0x75F79000 C:\WINDOWS\System32\davclnt.dll 0x75F80000 - 0x7607C000 C:\WINDOWS\System32\browseui.dll 0x76C90000 - 0x76CB2000 C:\WINDOWS\system32\imagehlp.dll 0x6D510000 - 0x6D58D000 C:\WINDOWS\system32\DBGHELP.dll 0x76BF0000 - 0x76BFB000 C:\WINDOWS\System32\PSAPI.DLL Heap at VM Abort: Heap def new generation total 576K, used 214K [0x10010000, 0x100b0000, 0x104f0000) eden space 512K, 39% used [0x10010000, 0x100430a8, 0x10090000) from space 64K, 16% used [0x10090000, 0x10092af0, 0x100a0000) to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000) tenured generation total 1408K, used 209K [0x104f0000, 0x10650000, 0x14010000) the space 1408K, 14% used [0x104f0000, 0x10524490, 0x10524600, 0x10650000) compacting perm gen total 4096K, used 1674K [0x14010000, 0x14410000, 0x18010000) the space 4096K, 40% used [0x14010000, 0x141b28a8, 0x141b2a00, 0x14410000) Local Time = Tue Oct 21 16:41:46 2003 Elapsed Time = 10 # # The exception above was detected in native code outside the VM # # Java VM: Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode) # # An error report file has been saved as hs_err_pid3180.log. # Please refer to the file for further information. # Process terminated with exit code 1

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java