On Wed, 2012-02-29 at 17:00 +0100, Stephan Bergmann wrote:
> Strange.  At least for my (--enable-dbgutil) master build, following the 
> instructions of fdo#46340 *does* lead to a restart with crash dialog and 
> document recovery.

        Interesting; well - I built with make ENABLE_SYMBOLS=true but otherwise
a reasonably normal build (AFAICS), I don't use --enable-dbgutil myself.

> Also, experimenting with the attached crash.patch (see also 
> <https://issues.apache.org/ooo/show_bug.cgi?id=108411> "let SID_CRASH 
> really crash") does lead to the crash dialog in all four variations of 
> the code (std::abort() vs. throw std::bad_alloc() and directly from main 
> thread vs. pthread_create).

        For me with:

+                fprintf (stderr, "Crash !\n");
+                throw ::std::bad_alloc();

        I get:

./soffice -writer
Warning: -writer is deprecated.  Use --writer instead.

Crash !
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

        And no crash handler. I guess I have a linkoo'd build perhaps something
there is causing grief.

        I attach the patch, and sample macro in case someone else has a more
'producty' build handy and wants to try.

        Incidentally, I love your crash patch :-) IMHO we badly need some unit
tests for crash recovery and a nice built-in simulated crash is rather
useful.

        HTH,

                Michael.

-- 
michael.me...@suse.com  <><, Pseudo Engineer, itinerant idiot
diff --git a/framework/uiconfig/startmodule/menubar/menubar.xml b/framework/uiconfig/startmodule/menubar/menubar.xml
index 055810b..8bebe1c 100755
--- a/framework/uiconfig/startmodule/menubar/menubar.xml
+++ b/framework/uiconfig/startmodule/menubar/menubar.xml
@@ -2,6 +2,7 @@
 <menu:menubar xmlns:menu="http://openoffice.org/2001/menu"; menu:id="menubar">
     <menu:menu menu:id=".uno:PickList">
         <menu:menupopup>
+            <menu:menuitem menu:id=".uno:Crash"/>
             <menu:menuitem menu:id=".uno:AddDirect"/>
             <menu:menuitem menu:id=".uno:Open"/>
             <menu:menuitem menu:id=".uno:RecentFileList"/>
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 8070b51..8826081 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -180,6 +180,7 @@ static void showDocument( const char* pBaseName )
     }
 }
 
+/*SB*/extern"C"{static void*SBFail(void*){/*SB std::abort(); */throw std::bad_alloc();}}
 void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
 {
     bool bDone = false;
@@ -543,8 +544,11 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
         case SID_CRASH :
         {
             // Provoke a crash:
-            char * crash = 0;
-            *crash = 0;
+//SB            char * crash = 0;
+//SB            *crash = 0;
+/*SB SBFail(0); */pthread_t SBt;pthread_create(&SBt,0,SBFail,0);
+                fprintf (stderr, "Crash !\n");
+                throw ::std::bad_alloc();
             break;
         }
 
diff --git a/solenv/gbuild/platform/linux.mk b/solenv/gbuild/platform/linux.mk
index 71508f2..e274830 100644
--- a/solenv/gbuild/platform/linux.mk
+++ b/solenv/gbuild/platform/linux.mk
@@ -27,7 +27,11 @@
 
 gb_LinkTarget_LDFLAGS += \
         -Wl,-z,defs \
+        -pthread
 
 include $(GBUILDDIR)/platform/unxgcc.mk
 
+gb_LinkTarget_CFLAGS += -pthread
+gb_LinkTarget_CXXFLAGS += -pthread
+
 # vim: set noet sw=4 ts=4:

Attachment: crash-test.odt
Description: application/vnd.oasis.opendocument.text

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to