danishjuzdan / jnativehook

Automatically exported from code.google.com/p/jnativehook
0 stars 0 forks source link

Some times it generates error and application crashes #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have developed application using jnativehook that prints color code in the 
java console, it works for two or three times than it crashes down generating 
following error (below three lines are my application output and under that 
there is error, I am attaching one more error file to look at.)

Red Color value = 194
Green Color value = 117
Blue Color value = 37

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d9b6b09, pid=3408, tid=1232
#
# JRE version: 6.0_21-b07
# Java VM: Java HotSpot(TM) Client VM (17.0-b17 mixed mode, sharing windows-x86 
)
# Problematic frame:
# V  [jvm.dll+0x106b09]

Original issue reported on code.google.com by ashish.s...@tatvasoft.com on 12 Sep 2011 at 8:23

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for reporting the issue.  Is the issue reproducible or does it occur 
randomly?  What version of windows are you using?

Original comment by heispsyc...@gmail.com on 12 Sep 2011 at 6:45

GoogleCodeExporter commented 9 years ago
One more thing, Are you using java threads with the library?

Original comment by heispsyc...@gmail.com on 12 Sep 2011 at 6:53

GoogleCodeExporter commented 9 years ago

Original comment by heispsyc...@gmail.com on 12 Sep 2011 at 6:54

GoogleCodeExporter commented 9 years ago
the issue occurs randomly, and I m using windows 7.

and I have attached code for my application

Original comment by ashish.s...@tatvasoft.com on 14 Sep 2011 at 6:57

Attachments:

GoogleCodeExporter commented 9 years ago
Ok I was able to duplicate the issue.

Original comment by heispsyc...@gmail.com on 14 Sep 2011 at 6:11

GoogleCodeExporter commented 9 years ago
Just an update.  I think I have a solution, the problem probably also effects 
all the platforms so I am going to do some cleanup and testing tomorrow.  

Original comment by heispsyc...@gmail.com on 15 Sep 2011 at 11:54

GoogleCodeExporter commented 9 years ago
Ok

Original comment by ashish.s...@tatvasoft.com on 16 Sep 2011 at 4:52

GoogleCodeExporter commented 9 years ago
This build seems to be working for me.  Give it a shot, let me know if you are 
still having problems. 

Original comment by heispsyc...@gmail.com on 16 Sep 2011 at 6:18

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks, I will try it soon.

Original comment by ashish.s...@tatvasoft.com on 17 Sep 2011 at 5:34

GoogleCodeExporter commented 9 years ago
Still having the same problem, my code works fine if I remove jnative hook, I 
suspect the problem is combination of clipboard and native hook? Please guide 
me.

This time I received attached error and also attaching my entire code folder.

Original comment by ashish.s...@tatvasoft.com on 17 Sep 2011 at 5:56

Attachments:

GoogleCodeExporter commented 9 years ago
I have isolated the issue to the following code block:

try {
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (UnsupportedLookAndFeelException ex) {
} catch (IllegalAccessException ex) {
} catch (InstantiationException ex) {
} catch (ClassNotFoundException ex) {
}
//Turn off metal's use of bold fonts 
UIManager.put("swing.boldMetal", Boolean.FALSE);

This is a different issue than we previously had but could be related.  
Question is why does setting the look and feel crash JNI.

Original comment by heispsyc...@gmail.com on 17 Sep 2011 at 8:36

GoogleCodeExporter commented 9 years ago
This is identical to the version that is currently crashing except that it has 
2 print statements in it to hopefully shed some light on whats going on.  I was 
able to duplicate the issue and now its working again for me and I cannot get 
it to crash.  Let me know if the Test prompt comes out true or if the Test 
memory address changes.  I am running out of ideas but I think the jni call may 
be attaching to a different thread, like the awt event dispatch thread, 
periodically and causing the vm to crash.

Original comment by heispsyc...@gmail.com on 18 Sep 2011 at 6:04

Attachments:

GoogleCodeExporter commented 9 years ago
ok thanks for your help, it seems working.

Original comment by ashish.s...@tatvasoft.com on 20 Sep 2011 at 2:17

GoogleCodeExporter commented 9 years ago
I'm going to box up a new version in the next few days.  The version attached 
has a problem where it just seems to stop working after some time.  Please 
reopen if the issue comes back.

Original comment by heispsyc...@gmail.com on 21 Sep 2011 at 5:47

GoogleCodeExporter commented 9 years ago
Ok, this is not fixed but I am fairly confident I know why.  The solution is 
not going to be easy and is probably not going to happen until I finish a paper 
associated with this project.  The issue has to do with other events being 
dispatched while the current event is being processed. Ex: the mouse button 
event was dispatched to your application which does a fair amount of 
processing.  While that processing is occurring if a mouse motion event occurs, 
the JVM crashes. 

The workaround is simple and should be used until either I implement an event 
dispatch method or tap into the AWT Event dispatch thread.

SwingUtilities.invokeLater(new Runnable() {
    public void run() {
        getcolorcode();
    }
});

Please let me know if you experience a crash using the invokeLater method.

Original comment by heispsyc...@gmail.com on 21 Sep 2011 at 6:59