From: Shawn H. <ph...@re...> - 2006-11-16 03:16:58
|
Hi buddies, I am working for BUG - launching scim xim segfaults when already running. please refers to https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=206995 . I un-inlined all exception classes (in attached patch). It can fix this bug. But the program still segaults on another place when system exit. The reason is when program exit, libc or stdc++ will cleanup all global object, and x11 frontend module register some slots to a config object (it is a global object), and the config object will destroy when system exit. It will destroy all slots that belong to it. slots are template class. I think they are also inline , their text is also in the module. Destroying them has the same problem like the exception object. :( It's difficult to make x11 module perfectly cleanup before unload. It seem that scim leaks disconnect interfaces for unregister slots. So currently the easiest way to fix it is that scim does not unload any modules. :( Comments are welcome. Thanks Shawn Huang === patch begin === diff -Nur scim-1.4.4-20060716.orig/src/Makefile.am scim-1.4.4-20060716/src/Makefile.am --- scim-1.4.4-20060716.orig/src/Makefile.am 2006-11-15 16:38:08.000000000 +0800 +++ scim-1.4.4-20060716/src/Makefile.am 2006-11-15 16:39:06.000000000 +0800 @@ -126,7 +126,8 @@ scim_slot.cpp \ scim_socket.cpp \ scim_transaction.cpp \ - scim_utility.cpp + scim_utility.cpp \ + scim_exception.cpp libscim_1_0_la_LDFLAGS = -version-info $(SCIM_CURRENT):$(SCIM_REVISION):$(SCIM_AGE) \ -export-dynamic \ diff -Nur scim-1.4.4-20060716.orig/src/scim_exception.cpp scim-1.4.4-20060716/src/scim_exception.cpp --- scim-1.4.4-20060716.orig/src/scim_exception.cpp 1970-01-01 08:00:00.000000000 +0800 +++ scim-1.4.4-20060716/src/scim_exception.cpp 2006-11-15 16:39:06.000000000 +0800 @@ -0,0 +1,40 @@ +/* + * scim_exception.cpp + * This file is part of scim + * + * Copyright (C) 2006 - ph...@re... + * + * scim is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * scim is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with scim; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ +#include <scim.h> +namespace scim { + +Exception::Exception (const String& what_arg) + : m_what(what_arg) +{ +} + +Exception::~Exception () throw () +{ +} + +const char* +Exception::what () const throw () +{ + return m_what.c_str (); +} + +} diff -Nur scim-1.4.4-20060716.orig/src/scim_exception.h scim-1.4.4-20060716/src/scim_exception.h --- scim-1.4.4-20060716.orig/src/scim_exception.h 2005-01-10 16:30:53.000000000 +0800 +++ scim-1.4.4-20060716/src/scim_exception.h 2006-11-15 16:39:06.000000000 +0800 @@ -46,9 +46,9 @@ { String m_what; public: - Exception (const String& what_arg) : m_what (what_arg) { } - ~Exception () throw () {} - virtual const char* what () const throw () { return m_what.c_str (); } + Exception (const String& what_arg); + ~Exception () throw (); + virtual const char* what () const throw (); }; /** @} */ diff -Nur scim-1.4.4-20060716.orig/src/scim_frontend.cpp scim-1.4.4-20060716/src/scim_frontend.cpp --- scim-1.4.4-20060716.orig/src/scim_frontend.cpp 2005-06-27 00:35:33.000000000 +0800 +++ scim-1.4.4-20060716/src/scim_frontend.cpp 2006-11-15 16:39:06.000000000 +0800 @@ -37,6 +37,16 @@ typedef std::map <int, IMEngineInstancePointer> IMEngineInstanceRepository; #endif +FrontEndError::FrontEndError (const String& what_arg) + : Exception (String("scim::FrontEnd: ") + what_arg) +{ +} + +FrontEndError::~FrontEndError ( ) throw() +{ +} + + class FrontEndBase::FrontEndBaseImpl { public: diff -Nur scim-1.4.4-20060716.orig/src/scim_frontend.h scim-1.4.4-20060716/src/scim_frontend.h --- scim-1.4.4-20060716.orig/src/scim_frontend.h 2005-10-07 02:02:06.000000000 +0800 +++ scim-1.4.4-20060716/src/scim_frontend.h 2006-11-15 16:39:06.000000000 +0800 @@ -47,8 +47,8 @@ class FrontEndError: public Exception { public: - FrontEndError (const String& what_arg) - : Exception (String("scim::FrontEnd: ") + what_arg) { } + FrontEndError (const String& what_arg); + ~FrontEndError() throw(); }; class FrontEndBase; === patch end === |