diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-10-30 18:18:40 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-10-30 18:39:20 +0100 |
commit | 16e72215c96ee734e2cf6d15a465577d289a1549 (patch) | |
tree | 89a52e235e3bda331dec4486bb7a3d1d6dfe8e35 /desktop | |
parent | a7339737f4bab4daf0c5843e36e2988919e6691f (diff) |
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
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/main.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/desktop/source/app/main.c b/desktop/source/app/main.c index c18fabd158d2..663c35e33eb9 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: */ |