From: Richard Dale Date: 2004-10-04T21:34:53+09:00 Subject: Re: Trapping 'exit from ruby world' in a C extension Richard Dale wrote: > I've looking into a problem with the QtRuby extension when it occasionally > crashes on exit. I think it's caused be ruby finalizing the objects in an > arbitrary order. What I'd like to be able to do is to have a hook so that > I can call the C++ destructor on the top level application instance, > KApplication while the ruby world is still complete. I've found a function > called 'rb_trap_exit()', but I'm not sure if that's intended for this use. > > Here is the top of the crash trace. rb_gc_call_finalizer_at_exit() has > probably deleted some things already before ~x_KApplication() is called > and which were still needed. I've actually managed to solve this problem a different way now, by deleting the QApplication or KApplication C++ instance after they return from the top level exec() call and before the ruby program exits. -- Richard