Bennett Helm wrote:
> On Nov 29, 2006, at 12:36 PM, Peter Kümmel wrote:
> 
>> OK, the patch has tested if theApp is valid, and it seems it is, but
>> it crashes anyway. So here a patch which tests if the reason for the
>> crash is the pure virtual function. It could be that is also does
>> not help, but I hope it does.
> 
> Still crashes. Here's the new backtrace.
> 

At least a more verbose backtrace.

> Assertion triggered in T* boost::scoped_ptr<T>::operator->() const [with
> T = lyx::frontend::Application] by failing check "ptr != 0" in file
> ../boost/boost/scoped_ptr.hpp:94
> Assertion triggered in T* boost::scoped_ptr<T>::operator->() const [with
> T = lyx::LyXServer] by failing check "ptr != 0" in file
> ../boost/boost/scoped_ptr.hpp:94
> 

The first assert while calling quit the second one while
handling the assert (emergencyCleanup).

> Program received signal SIGABRT, Aborted.
> 0x9003d1dc in kill ()
> (gdb) bt
> #0  0x9003d1dc in kill ()
> #1  0x9010f2af in raise ()
> #2  0x9010de02 in abort ()
> #3  0x0010ec57 in lyx::support::abort () at abort.C:25
> #4  0x0006c110 in lyx::LyX::emergencyCleanup (this=0xbffff954) at
> ../boost/boost/scoped_ptr.hpp:94
> #5  0x0002798b in boost::emergencyCleanup () at boost.C:45
> #6  0x00027a55 in boost::assertion_failed (expr=0x5c2610 "ptr != 0",
> function=0x5d0918 "T* boost::scoped_ptr<T>::operator->() const [with T =
> lyx::frontend::Application]", file=0x5c25f0
> "../boost/boost/scoped_ptr.hpp", line=94) at boost.C:55
> #7  0x0006934a in lyx::LyX::quit (this=0xbffff954) at
> ../boost/boost/scoped_ptr.hpp:94
> #8  0x00069394 in lyx::LyX::~LyX (this=0xbffff954) at lyx_main.C:179
> #9  0x00003035 in main (argc=1, argv=0xbffff9e4) at main.C:48
> 
> Bennett
> 

Looks like quit is called twice or before anything is created,
 but it's hard to say without a Mac.

What's the output with attached patch? (don't remove the last patch)

Hope you don't get annoyed by all these patching and compiling.

Peter
Index: src/lyx_main.C
===================================================================
--- src/lyx_main.C      (Revision 16106)
+++ src/lyx_main.C      (Arbeitskopie)
@@ -447,15 +447,31 @@
 
 void LyX::quit()
 {
+       static int  i = 1;
+       printf("LyX::quit() called: %i\n", i);
+       i++;
        lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
 
+       printf("LyX::quit()  1\n");
        prepareExit();
-
+       printf("LyX::quit()  2\n");
        if (use_gui) {
-               pimpl_->session_->writeFile();
+               if (pimpl_->session_)
+               {
+                       pimpl_->session_->writeFile();
+                       printf("LyX::quit()  3\n");
+               }
+               printf("LyX::quit()  4\n");
                pimpl_->lyx_server_.reset();
+               printf("LyX::quit()  5\n");
                pimpl_->lyx_socket_.reset();
-               pimpl_->application_->exit(0);
+               printf("LyX::quit()  6\n");
+               if (pimpl_->application_)
+               {
+                       pimpl_->application_->exit(0);
+                       printf("LyX::quit()  7\n");
+               }
+               printf("LyX::quit()  8\n");
                theApp = 0;
        }
 }
@@ -930,7 +946,8 @@
 
        pimpl_->buffer_list_.emergencyWriteAll();
        if (use_gui) {
-               pimpl_->lyx_server_->emergencyCleanup();
+               if (pimpl_->lyx_server_)
+                       pimpl_->lyx_server_->emergencyCleanup();
                pimpl_->lyx_server_.reset();
                pimpl_->lyx_socket_.reset();
        }

Reply via email to