Re: Application Error (JVM crashes and hangs)

"Vitaly Shelest(home)" <[email protected]>
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <001501c543fc$4d913a30$660fa8c0@vitallis>
I guess this is a problem of finalization. Having called Ole32.CoUninitialize(); all COM pointers become invalid. GC calls finalize method in other thread for invalid COM object to release it. This is the problem of explicit call of Ole32.CoInitialize(); Ole32.CoUninitialize(); In my ver. of JAWIN they are hidden and called in proper place. I also added code for hidden COM object thread marshaling if it is needed.
In C++ code before call Ole32.CoUninitialize(); you should release all COM objects. Try to do this in your code and suppress releases in finalization.
If on exit you do not release all COM object the application can hang.

  ----- Original Message ----- 
  From: Miroslav Tichy 
  Newsgroups: gmane.comp.windows.devel.jawin
  Sent: Monday, April 18, 2005 9:46 AM
  Subject: Application Error (JVM crashes and hangs)


  Hi, this is my problem:-)
  When I call any method of the stub of the COM object (not only the business
  logic), I recieve acceptable result, but when leaving the main method (more
  precisely private void exit() on Thread when destroying the JVM), error
  window with message: "the instruction at xxx referenced memory at xxx. The
  memory could not be read" pops up and the thread hangs.

  Here is the code...(nothing surprising I guess....)
  ....
  Ole32.CoInitialize();
  //generated stub for COM object writen in MS Fox and accessing Clipper DBF
  file through the ODBC
  Inetwrs net = new Inetwrs(netwrs.CLSID);
  //here I call method which writes something to the DB and it really does
  it...!!!!!!
  Object o = net.zapis();
  Ole32.CoUninitialize();
  ...


  I tried combinations of jvm 1.3.1_15, 1.4.1_01,03, 1.5.0_01 and jawin
  1.0.19 and 2.0A all with the same result..

  Any ideas?
  thx very much, Mirek
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.