jna call to kernel32.CreateToolhelp32Snapshot in shutdown hook crashes the VM

Posted by jumar on Stack Overflow See other posts from Stack Overflow or by jumar
Published on 2009-11-05T15:52:00Z Indexed on 2010/03/25 3:03 UTC
Read the original article Hit count: 552

If a thread sets a shutdown hook using

Runtime.getRuntime().addShutdownHook();

calls via jna the method:

kernel32.CreateToolhelp32Snapshot (0x00000002, 0)

it crashes the VM. If I call the same method in the

WindowListener.windowClosing()

hook, the call does not crashes the VM.

Any idea why?

I can post part of the VM crash error report if it could be of any use.

edit: see the VM crash report on pastebin

© Stack Overflow or respective owner

Related posts about java

Related posts about jna