[Libreoffice-commits] .: desktop/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Oct 30 10:41:55 PDT 2012


 desktop/source/app/main.c |   28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

New commits:
commit 16e72215c96ee734e2cf6d15a465577d289a1549
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Oct 30 18:18:40 2012 +0100

    desktop: tweak xmlCleanupParser hack: disable on return from main
    
    Lubos has apparently a case of xmlCleanupParser run as an atexit
    handler, from KDE's Strigi library; hopefully this should help
    to avoid the abort then.
    
    Change-Id: I50d2e92e5078016943f71a62070743ab8d6628bb

diff --git a/desktop/source/app/main.c b/desktop/source/app/main.c
index c18fabd..663c35e 100644
--- a/desktop/source/app/main.c
+++ b/desktop/source/app/main.c
@@ -21,22 +21,38 @@
 
 #include "sofficemain.h"
 
-SAL_IMPLEMENT_MAIN() {
-    return soffice_main();
-}
-
 #ifdef DBG_UTIL
 #ifdef __gnu_linux__
 #include <stdio.h>
 #include <stdlib.h>
 
+int g_Exiting = 0;
+
 /* HACK: detect calls to xmlCleanupParser, which causes hard to debug crashes */
 __attribute__ ((visibility("default"))) void xmlCleanupParser(void)
 {
-    fprintf(stderr, "\n*** ERROR: DO NOT call xmlCleanupParser()\n\n");
-    abort();
+    /* there are libraries that register xmlCleanupParser as an atexit handler,
+       which is not entirely sound (another atexit handler could want to
+       use libxml), but not enough of a problem to complain.
+       (example found by llunak: KDE's Strigi library) */
+    if (!g_Exiting)
+    {
+        fprintf(stderr, "\n*** ERROR: DO NOT call xmlCleanupParser()\n\n");
+        abort();
+    }
 }
 #endif
 #endif
 
+SAL_IMPLEMENT_MAIN() {
+    int ret = soffice_main();
+#ifdef DBG_UTIL
+#ifdef __gnu_linux__
+    g_Exiting = 1;
+#endif
+#endif
+    return ret;
+}
+
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list