Closed GoogleCodeExporter closed 9 years ago
I also tried re-registering without putting the PC to sleep. It still causes a
SIGSEGV fatal error.
Steps:
GlobalScreen.registerNativeHook();
GlobalScreen.getInstance().addNativeKeyListener(this);
GlobalScreen.getInstance().addNativeMouseListener(this);
GlobalScreen.getInstance().addNativeMouseMotionListener(this);
... do something else ...
GlobalScreen.getInstance().removeNativeKeyListener(this);
GlobalScreen.getInstance().removeNativeMouseListener(this);
GlobalScreen.getInstance().removeNativeMouseMotionListener(this);
GlobalScreen.unregisterNativeHook();
try { Thread.sleep(1000); } catch (Exception e) { }
System.err.println("reg hook...");
GlobalScreen.registerNativeHook();
System.err.println("Done rereg.");
I never see the "Done rereg" line. It crashes after "reg hook...".
Original comment by postmark...@gmail.com
on 8 Feb 2013 at 3:53
I can produce the segfault by simply starting and stopping the registration.
When putting the computer to sleep, it looks like XRecord just stops for what
ever reason. The segfault will need to be addressed. I am not sure if the
stopping of XRecord can be fixed. I will probably file another bug report
upstream about the issue and see if it would be possible to implement a
workaround.
0x00007f6864b8dbf0 in jni_CallStaticObjectMethod () from
/opt/sun-jdk-1.6.0.39/jre/lib/amd64/server/libjvm.so
(gdb) bt
#0 0x00007f6864b8dbf0 in jni_CallStaticObjectMethod () from
/opt/sun-jdk-1.6.0.39/jre/lib/amd64/server/libjvm.so
#1 0x00007f6859768b5f in ThreadProc (arg=0x7f680401faa0) at
/home/kwhat/NetBeansProjects/JNativeHook_1.1/src/native/unix/NativeThread.c:479
#2 0x0000003059208ec6 in start_thread () from /lib64/libpthread.so.0
#3 0x00000030586ea86d in clone () from /lib64/libc.so.6
Original comment by a...@1stleg.com
on 11 Feb 2013 at 2:32
At least part of this bug is related to bug #37. Can you test and see if it
segfaults on any other platform besides linux?
Original comment by a...@1stleg.com
on 11 Feb 2013 at 2:54
I run Windows at work, but I haven't been able to try it yet. I haven't
forgotten.
Original comment by postmark...@gmail.com
on 13 Feb 2013 at 1:13
I am seeing the same behavior on Windows XP. When I unregister and then
register again, a dialog appears titled "Visual Studio Just-In-Time Debugger",
and it says "An unhandled win32 exception occured in java.exe [5804].
Original comment by postmark...@gmail.com
on 15 Feb 2013 at 6:38
hmm well I definitely broke something with the JNI. I am pretty busy at the
moment but I will try to get this fixed as soon as I can.
Original comment by a...@1stleg.com
on 16 Feb 2013 at 3:32
I am 90% sure this is caused by the following line that is in the platforms
thread proc:
// Destroy all created globals.
#ifdef DEBUG
if (DestroyJNIGlobals() == RETURN_FAILURE) {
fprintf(stderr, "ThreadProc(): DestroyJNIGlobals() failed!\n");
}
#else
DestroyJNIGlobals();
#endif
If you want to patch and compile locally it should work. I am doing a little
restructuring to address part of bug #37 before I commit.
Original comment by a...@1stleg.com
on 16 Feb 2013 at 4:43
Ok,I have tested on Linux x86_64 and restarting the hook seems to be working.
I have attached a debug build for testing all platforms. Please give it a try
and let me know if it works for you with the sleeping/hibernating.
Thanks!
Original comment by a...@1stleg.com
on 16 Feb 2013 at 5:56
Attachments:
Great job! It doesn't crash any more (on my Linux box).
Sleep issue: re-registering immediately after waking up does not work. It
doesn't crash any more, but I don't receive events either. Therefore I changed
my code to wait approximately one minute, then re-register, and I start
receiving events again! Great!
Thanks for looking into this. :-)
Original comment by postmark...@gmail.com
on 17 Feb 2013 at 2:54
There is no reason that it shouldn't resume after sleeping. I will leave the
bug open with a lower priority until I can figure out why.
Original comment by a...@1stleg.com
on 7 Mar 2013 at 12:52
Original comment by a...@1stleg.com
on 11 Mar 2013 at 11:15
Please re-test with 1.2.0-Beta1, thanks!
Original comment by a...@1stleg.com
on 22 Jan 2014 at 7:26
Tested working as of Beta 2.
Original comment by a...@1stleg.com
on 16 Apr 2014 at 11:48
Original issue reported on code.google.com by
postmark...@gmail.com
on 8 Feb 2013 at 3:43