title: Fatal error running an SWT application from OpenOffice
body: <p>I have an <a href="http://en.wikipedia.org/wiki/OpenOffice.org" rel="nofollow">OpenOffice</a> Java addon application. I'm calling <a href="http://en.wikipedia.org/wiki/Standard_Widget_Toolkit" rel="nofollow">SWT</a> from an <code>XActionListener</code>. Loading of SWT is done dynamically using a special class loader. The SWT window displays well, but when I hit the close button of an SWT window I get an error. I'm attaching the error file generated by this error.</p>
  
  <p>What is the meaning of this error?</p>
  
  <p><strong>My SWT code</strong></p>
  
  <pre><code> final Display display = Display.getDefault();
      final Shell shell = new Shell();
      shell.setLayout(new FillLayout(SWT.VERTICAL));
      shell.setSize(500, 375);
      shell.setText("SWT Application");
      final Browser browser = new Browser(shell, SWT.NONE);
      browser.setUrl(location);
  
      try {
          try {
              shell.open();
              shell.layout();
              while (!shell.isDisposed()) {
                  if (!display.readAndDispatch()) {
                      display.sleep();
                  }
              }
          } finally {
              if (!shell.isDisposed()) {
                  shell.dispose();
              }
          }
      } finally {
          display.dispose();
      }
  </code></pre>
  
  <p>-------Error file-------</p>
  
  <pre><code>        A fatal error has been detected by the Java Runtime Environment:
  
            EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x77779c21, pid=968, tid=2176
  
           JRE version: 6.0_26-b03
           Java VM: Java HotSpot(TM) Client VM (20.1-b02 mixed mode windows-x86 )
           Problematic frame:
           C  [ntdll.dll+0x59c21]
      ---------------  T H R E A D  ---------------
  
  Current thread (0x0ad67400):  VMThread [stack: 0x26160000,0x26af0000] [id=3688]
  
  siginfo: ExceptionCode=0xc0000005, reading address 0xffffffff
  
  Registers:
  EAX=0xfffffff8, EBX=0x00000000, ECX=0x00000008, EDX=0x00000e68
  ESP=0x26aeebfc, EBP=0x26aeec04, ESI=0x0acd0000, EDI=0x0f97760c
  EIP=0x77779c21, EFLAGS=0x00010282
  
  Top of Stack: (sp=0x26aeebfc)
  0x26aeebfc:   26aeed10 0f9c5d1c 26aeec50 7c3420d6
  0x26aeec0c:   0acd0000 00000000 00000000 0f97760c
  0x26aeec1c:   0f9c5d1c 26aeed10 00000000 0f97760c
  0x26aeec2c:   7c38b348 001a0018 73bb19c4 26aeec18
  0x26aeec3c:   26aee808 26aeec7c 7c34240d 7c37a368
  0x26aeec4c:   ffffffff 26aeec8c 7c34c0b4 00000000
  0x26aeec5c:   0f97760c 00000003 26aeed10 d1eb85ce
  0x26aeec6c:   61c267d4 ffffffff 26aeec5c 26aee808
  
  Instructions: (pc=0x77779c21)
  0x77779c01:   85 3e f7 02 00 53 33 db f6 46 48 01 0f 85 75 f7
  0x77779c11:   02 00 8b 45 10 a8 07 0f 85 57 f7 02 00 83 c0 f8
  0x77779c21:   80 78 07 05 0f 84 33 f7 02 00 f6 40 07 3f 0f 84
  0x77779c31:   37 f7 02 00 3b c3 0f 84 5a f7 02 00 8a 48 07 80
  
  
  Register to memory mapping:
  
  EAX=
  [error occurred during error reporting (printing register info), id 0xc0000005]
  
  Stack: [0x26160000,0x26af0000],  sp=0x26aeebfc,  free space=9786k
  Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
  C  [ntdll.dll+0x59c21]  RtlSizeHeap+0x35
  C  0x7c3420d6  msize+0x34
  C  0x7c34c0b4  _dllonexit+0x1f
  C  0x0f94a1ba  JVM_FindSignal+0xce49a
  C  0x0f880c8f  JVM_FindSignal+0x4f6f
  C  0x0f8811be  JVM_FindSignal+0x549e
  C  0x7c349565  endthreadex+0xa0
  C  [kernel32.dll+0x4ed6c]  BaseThreadInitThunk+0x12
  C  [ntdll.dll+0x637f5]  RtlInitializeExceptionChain+0xef
  C  [ntdll.dll+0x637c8]  RtlInitializeExceptionChain+0xc2
  
  VM_Operation (0x00c7eb20): Exit, mode: safepoint, requested by thread 0x0acda800
  
  
  ---------------  P R O C E S S  ---------------
  
  Java Threads: ( =&gt; current thread )
    0x0adaa400 JavaThread "AWT-Shutdown" [_thread_blocked, id=3524, stack(0x3dc40000,0x3e5d0000)]
    0x2e14d800 JavaThread "http-bio-8080-exec-2" daemon [_thread_in_native, id=4088, stack(0x2ef20000,0x2f8b0000)]
    0x2e054c00 JavaThread "http-bio-8080-exec-1" daemon [_thread_blocked, id=3800, stack(0x38840000,0x391d0000)]
    0x2e04b800 JavaThread "http-bio-8080-AsyncTimeout" daemon [_thread_blocked, id=2636, stack(0x321d0000,0x32b60000)]
    0x2e04a000 JavaThread "http-bio-8080-Acceptor-0" daemon [_thread_in_native, id=316, stack(0x31840000,0x321d0000)]
    0x2e009800 JavaThread "ContainerBackgroundProcessor[StandardEngine[Tomcat]]" daemon [_thread_blocked, id=1068, stack(0x30e40000,0x317d0000)]
    0x2df4f000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=1792, stack(0x2e3b0000,0x2ed40000)]
    0x0acda800 JavaThread "Thread-20" [_thread_blocked, id=1636, stack(0x002f0000,0x00c80000)]
    0x0fda8800 JavaThread "Thread-16" daemon [_thread_blocked, id=692, stack(0x2d490000,0x2de20000)]
    0x0adc4000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3664, stack(0x2bf90000,0x2c920000)]
    0x0adc3000 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=3520, stack(0x2b5a0000,0x2bf30000)]
    0x0adaa000 JavaThread "JDWP Command Reader" daemon [_thread_blocked, id=1352, stack(0x2ab00000,0x2b490000)]
    0x0ada9000 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=2464, stack(0x2a0e0000,0x2aa70000)]
    0x0ada6c00 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=1076, stack(0x29580000,0x29f10000)]
    0x0ad9a000 JavaThread "Attach Listener" daemon [_thread_blocked, id=4044, stack(0x28a00000,0x29390000)]
    0x0ad99400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3100, stack(0x28030000,0x289c0000)]
    0x0ad6cc00 JavaThread "Finalizer" daemon [_thread_blocked, id=3940, stack(0x27640000,0x27fd0000)]
    0x0ad6b800 JavaThread "Reference Handler" daemon [_thread_blocked, id=840, stack(0x26b00000,0x27490000)]
  
  Other Threads:
  =&gt;0x0ad67400 VMThread [stack: 0x26160000,0x26af0000] [id=3688]
  
  VM state:at safepoint (shutting down)
  
  VM Mutex/Monitor currently owned by a thread:  ([mutex/lock_event])
  [0x0acd8528] Threads_lock - owner thread: 0x0ad67400
  
  Heap
   def new generation   total 4928K, used 1272K [0x12120000, 0x12670000, 0x17670000)
    eden space 4416K,  23% used [0x12120000, 0x122257c8, 0x12570000)
    from space 512K,  44% used [0x12570000, 0x125a8940, 0x125f0000)
    to   space 512K,   0% used [0x125f0000, 0x125f0000, 0x12670000)
   tenured generation   total 10944K, used 3039K [0x17670000, 0x18120000, 0x22120000)
     the space 10944K,  27% used [0x17670000, 0x17967e80, 0x17968000, 0x18120000)
   compacting perm gen  total 15616K, used 15451K [0x22120000, 0x23060000, 0x26120000)
     the space 15616K,  98% used [0x22120000, 0x23036dd0, 0x23036e00, 0x23060000)
  No shared spaces configured.
  
  Code Cache  [0x10120000, 0x102a0000, 0x12120000)
   total_blobs=763 nmethods=584 adapters=123 free_code_cache=32023424 largest_free_block=25792
  
  Dynamic libraries:
  0x001d0000 - 0x002df000     C:\Program Files\LibreOffice 3.4\program\soffice.bin
  0x77720000 - 0x7785c000     C:\Windows\SYSTEM32\ntdll.dll
  0x76340000 - 0x76414000     C:\Windows\system32\kernel32.dll
  0x75a60000 - 0x75aaa000     C:\Windows\system32\KERNELBASE.dll
  0x64d00000 - 0x64d34000     C:\Program Files\AVAST Software\Avast\snxhk.dll
  0x67670000 - 0x676bd000     C:\Program Files\LibreOffice 3.4\URE\bin\sal3.dll
  0x6a6a0000 - 0x6a6ab000     C:\Program Files\LibreOffice 3.4\URE\bin\uwinapi.dll
  0x75ee0000 - 0x75fa9000     C:\Windows\system32\USER32.dll
  0x75e90000 - 0x75ede000     C:\Windows\system32\GDI32.dll
  0x766a0000 - 0x766aa000     C:\Windows\system32\LPK.dll
  0x76760000 - 0x767fd000     C:\Windows\system32\USP10.dll
  0x778a0000 - 0x7794c000     C:\Windows\system32\msvcrt.dll
  0x76130000 - 0x761d0000     C:\Windows\system32\ADVAPI32.dll
  0x766b0000 - 0x766c9000     C:\Windows\SYSTEM32\sechost.dll
  0x76080000 - 0x76121000     C:\Windows\system32\RPCRT4.dll
  0x74dc0000 - 0x74dc9000     C:\Windows\system32\VERSION.dll
  0x73bb0000 - 0x73c53000     C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCR90.dll
  0x761d0000 - 0x76227000     C:\Windows\system32\SHLWAPI.dll
  0x73b10000 - 0x73b17000     C:\Windows\system32\WSOCK32.dll
  0x77860000 - 0x77895000     C:\Windows\system32\WS2_32.dll
  0x769a0000 - 0x769a6000     C:\Windows\system32\NSI.dll
  0x76460000 - 0x765bc000     C:\Windows\system32\ole32.dll
  0x73b20000 - 0x73bae000     C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCP90.dll
  0x71e50000 - 0x71e62000     C:\Windows\system32\MPR.dll
  0x769b0000 - 0x775fa000     C:\Windows\system32\SHELL32.dll
  0x6a640000 - 0x6a69e000     C:\Program Files\LibreOffice 3.4\program\sofficeapp.dll
  0x61f00000 - 0x62017000     C:\Program Files\LibreOffice 3.4\program\comphelpMSC.dll
  0x620c0000 - 0x6213b000     C:\Program Files\LibreOffice 3.4\URE\bin\cppuhelper3MSC.dll
  0x6d960000 - 0x6d968000     C:\Program Files\LibreOffice 3.4\URE\bin\salhelper3MSC.dll
  0x67190000 - 0x671c3000     C:\Program Files\LibreOffice 3.4\URE\bin\cppu3.dll
  0x62060000 - 0x620c0000     C:\Program Files\LibreOffice 3.4\program\ucbhelper4MSC.dll
  0x675d0000 - 0x675f7000     C:\Program Files\LibreOffice 3.4\program\deploymentmiscmi.dll
  0x61e30000 - 0x61eff000     C:\Program Files\LibreOffice 3.4\program\libdb47.dll
  0x61d90000 - 0x61e30000     C:\Program Files\LibreOffice 3.4\program\tlmi.dll
  0x61c80000 - 0x61d85000     C:\Program Files\LibreOffice 3.4\program\basegfxmi.dll
  0x6a630000 - 0x6a63b000     C:\Program Files\LibreOffice 3.4\program\i18nisolang1MSC.dll
  0x61b70000 - 0x61c74000     C:\Program Files\LibreOffice 3.4\program\utlmi.dll
  0x61aa0000 - 0x61b67000     C:\Program Files\LibreOffice 3.4\program\xcrmi.dll
  0x61780000 - 0x61a95000     C:\Program Files\LibreOffice 3.4\program\sfxmi.dll
  0x61700000 - 0x61776000     C:\Program Files\LibreOffice 3.4\program\fwemi.dll
  0x62020000 - 0x62051000     C:\Program Files\LibreOffice 3.4\program\fwimi.dll
  0x61620000 - 0x616fe000     C:\Program Files\LibreOffice 3.4\program\svlmi.dll
  0x615d0000 - 0x61616000     C:\Program Files\LibreOffice 3.4\program\sotmi.dll
  0x612a0000 - 0x615c9000     C:\Program Files\LibreOffice 3.4\program\svtmi.dll
  0x10000000 - 0x1011f000     C:\Program Files\LibreOffice 3.4\program\icuuc44.dll
  0x00e90000 - 0x01cd1000     C:\Program Files\LibreOffice 3.4\program\icudt44.dll
  0x679a0000 - 0x679be000     C:\Program Files\LibreOffice 3.4\URE\bin\jvmfwk3.dll
  0x00c80000 - 0x00d76000     C:\Program Files\LibreOffice 3.4\program\libxml2.dll
  0x61020000 - 0x61295000     C:\Program Files\LibreOffice 3.4\program\tkmi.dll
  0x60c90000 - 0x61018000     C:\Program Files\LibreOffice 3.4\program\vclmi.dll
  0x67ba0000 - 0x67bab000     C:\Program Files\LibreOffice 3.4\program\i18npapermi.dll
  0x67650000 - 0x67666000     C:\Program Files\LibreOffice 3.4\program\i18nutilMSC.dll
  0x74250000 - 0x743e0000     C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.17514_none_72d18a4386696c80\gdiplus.dll
  0x73650000 - 0x73655000     C:\Windows\system32\MSIMG32.dll
  0x6e190000 - 0x6e1e1000     C:\Windows\system32\WINSPOOL.DRV
  0x76320000 - 0x7633f000     C:\Windows\system32\IMM32.dll
  0x75fb0000 - 0x7607c000     C:\Windows\system32\MSCTF.dll
  0x67170000 - 0x6718e000     C:\Program Files\LibreOffice 3.4\program\saxmi.dll
  0x60a80000 - 0x60c83000     C:\Program Files\LibreOffice 3.4\program\sbmi.dll
  0x76230000 - 0x762bf000     C:\Windows\system32\OLEAUT32.dll
  0x743e0000 - 0x74420000     C:\Windows\system32\uxtheme.dll
  0x75840000 - 0x7584c000     C:\Windows\system32\CRYPTBASE.dll
  0x765c0000 - 0x765c5000     C:\Windows\system32\PSAPI.DLL
  0x609f0000 - 0x60a7e000     C:\Program Files\LibreOffice 3.4\URE\bin\bootstrap.uno.dll
  0x66370000 - 0x6638c000     C:\Program Files\LibreOffice 3.4\URE\bin\reg3.dll
  0x67b90000 - 0x67ba0000     C:\Program Files\LibreOffice 3.4\URE\bin\store3.dll
  0x67990000 - 0x6799f000     C:\Program Files\LibreOffice 3.4\URE\bin\xmlreader.dll
  0x609d0000 - 0x609e3000     C:\Program Files\LibreOffice 3.4\URE\bin\msci_uno.dll
  0x75860000 - 0x7586b000     C:\Windows\system32\profapi.dll
  0x60950000 - 0x609cd000     C:\Program Files\LibreOffice 3.4\program\configmgr.uno.dll
  0x67a10000 - 0x67a19000     C:\Program Files\LibreOffice 3.4\program\localebe1.uno.dll
  0x60930000 - 0x6094a000     C:\Program Files\LibreOffice 3.4\URE\bin\stocservices.uno.dll
  0x70da0000 - 0x70e01000     C:\Windows\system32\wer.dll
  0x60900000 - 0x60926000     C:\Program Files\LibreOffice 3.4\program\splmi.dll
  0x607a0000 - 0x608fb000     C:\Program Files\LibreOffice 3.4\program\i18npool.uno.dll
  0x078d0000 - 0x07a55000     C:\Program Files\LibreOffice 3.4\program\icuin44.dll
  0x60760000 - 0x6079b000     C:\Program Files\LibreOffice 3.4\program\ucb1.dll
  0x60580000 - 0x60755000     C:\Program Files\LibreOffice 3.4\program\fwkmi.dll
  0x60530000 - 0x60579000     C:\Program Files\LibreOffice 3.4\program\ucpfile1.dll
  0x73d40000 - 0x73d53000     C:\Windows\system32\dwmapi.dll
  0x604e0000 - 0x6052f000     C:\Program Files\LibreOffice 3.4\program\package2.dll
  0x603a0000 - 0x604d2000     C:\Program Files\LibreOffice 3.4\program\lngmi.dll
  0x60050000 - 0x60396000     C:\Program Files\LibreOffice 3.4\program\xomi.dll
  0x60030000 - 0x6004d000     C:\Program Files\LibreOffice 3.4\program\localedata_en.dll
  0x5ffe0000 - 0x6002c000     C:\Program Files\LibreOffice 3.4\program\ucpchelp1.dll
  0x063a0000 - 0x063cd000     C:\Program Files\LibreOffice 3.4\program\libxslt.dll
  0x5ffc0000 - 0x5ffd1000     C:\Program Files\LibreOffice 3.4\program\fileacc.dll
  0x5ff20000 - 0x5ffb9000     C:\Program Files\LibreOffice 3.4\program\deploymentmi.uno.dll
  0x5fef0000 - 0x5ff1b000     C:\Program Files\LibreOffice 3.4\program\helplinkermi.dll
  0x676f0000 - 0x676fa000     C:\Program Files\LibreOffice 3.4\program\ucpexpand1.uno.dll
  0x5fe90000 - 0x5feeb000     C:\Program Files\LibreOffice 3.4\program\unoxmlmi.dll
  0x5fe60000 - 0x5fe8b000     C:\Program Files\LibreOffice 3.4\program\sax.uno.dll
  0x5fe30000 - 0x5fe53000     C:\Program Files\LibreOffice 3.4\program\dnd.dll
  0x75340000 - 0x75356000     C:\Windows\system32\CRYPTSP.dll
  0x750e0000 - 0x7511b000     C:\Windows\system32\rsaenh.dll
  0x75850000 - 0x7585e000     C:\Windows\system32\RpcRtRemote.dll
  0x5fe10000 - 0x5fe29000     C:\Program Files\LibreOffice 3.4\program\fsstorage.uno.dll
  0x74730000 - 0x748ce000     C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\comctl32.dll
  0x76800000 - 0x7699d000     C:\Windows\system32\SETUPAPI.dll
  0x75b90000 - 0x75bb7000     C:\Windows\system32\CFGMGR32.dll
  0x75ab0000 - 0x75ac2000     C:\Windows\system32\DEVOBJ.dll
  0x766d0000 - 0x76753000     C:\Windows\system32\CLBCatQ.DLL
  0x744d0000 - 0x745c5000     C:\Windows\system32\propsys.dll
  0x74c80000 - 0x74ca1000     C:\Windows\system32\ntmarta.dll
  0x76650000 - 0x76695000     C:\Windows\system32\WLDAP32.dll
  0x5fdc0000 - 0x5fe10000     C:\Program Files\LibreOffice 3.4\program\oleautobridge.uno.dll
  0x5fd90000 - 0x5fdb9000     C:\Program Files\LibreOffice 3.4\program\emsermi.dll
  0x5fd50000 - 0x5fd8f000     C:\Program Files\LibreOffice 3.4\program\uuimi.dll
  0x5fd10000 - 0x5fd46000     C:\Program Files\LibreOffice 3.4\program\filterconfig1.dll
  0x5efa0000 - 0x5f844000     C:\Program Files\LibreOffice 3.4\program\swmi.dll
  0x5fcc0000 - 0x5fd05000     C:\Program Files\LibreOffice 3.4\program\avmediami.dll
  0x5fb80000 - 0x5fcb9000     C:\Program Files\LibreOffice 3.4\program\drawinglayermi.dll
  0x5fb00000 - 0x5fb7e000     C:\Program Files\LibreOffice 3.4\program\canvastoolsmi.dll
  0x705f0000 - 0x70622000     C:\Windows\system32\WINMM.dll
  0x5faa0000 - 0x5faf5000     C:\Program Files\LibreOffice 3.4\program\cppcanvasmi.dll
  0x5f910000 - 0x5fa9a000     C:\Program Files\LibreOffice 3.4\program\editengmi.dll
  0x5ebc0000 - 0x5ee52000     C:\Program Files\LibreOffice 3.4\program\svxmi.dll
  0x5e620000 - 0x5ebb2000     C:\Program Files\LibreOffice 3.4\program\svxcoremi.dll
  0x5f8f0000 - 0x5f910000     C:\Program Files\LibreOffice 3.4\program\sysdtrans.dll
  0x5f890000 - 0x5f8f0000     C:\Program Files\LibreOffice 3.4\program\xstor.dll
  0x5ef50000 - 0x5ef6c000     C:\Program Files\LibreOffice 3.4\URE\bin\reflection.uno.dll
  0x675c0000 - 0x675cb000     C:\Program Files\LibreOffice 3.4\URE\bin\javaloader.uno.dll
  0x67160000 - 0x6716a000     C:\Program Files\LibreOffice 3.4\URE\bin\jvmaccess3MSC.dll
  0x5ef30000 - 0x5ef4b000     C:\Program Files\LibreOffice 3.4\URE\bin\javavm.uno.dll
  0x5f880000 - 0x5f88b000     C:\Program Files\LibreOffice 3.4\program\wininetbe1.uno.dll
  0x77600000 - 0x7771a000     C:\Windows\system32\wininet.dll
  0x76420000 - 0x76423000     C:\Windows\system32\Normaliz.dll
  0x75bc0000 - 0x75d76000     C:\Windows\system32\iertutil.dll
  
  VM Arguments:
  jvm_args: -Xdebug -Xrunjdwp:transport=dt_socket,address=othman-PC:49896 abort -Dorg.openoffice.native= -Duser.language=en -Duser.country=US
  java_command: &lt;unknown&gt;
  Launcher Type: generic
  
  Environment Variables:
  JAVA_TOOL_OPTIONS="-Xdebug" "-Xrunjdwp:transport=dt_socket,address=othman-PC:49896"
  PATH=C:\Program Files\LibreOffice 3.4\URE\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Git\cmd
  USERNAME=othman
  OS=Windows_NT
  PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 10, GenuineIntel
  
  -------  S Y S T E M  -------
  
  OS: Windows 7 Build 7601 Service Pack 1
  
  CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 23 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1
  
  Memory: 4k page, physical 2059928k(765200k free), swap 4119856k(2602988k free)
  
  vm_info: Java HotSpot(TM) Client VM (20.1-b02) for windows-x86 JRE (1.6.0_26-b03), built on May  4 2011 00:50:59 by "java_re" with MS VC++ 7.1 (VS2003)
  
  time: Thu Aug 04 16:35:56 2011
  elapsed time: 7 seconds
  </code></pre>