ports/146544: Inkscape crashes when locale is enabled

Joerg Wunsch joerg at FreeBSD.org
Thu May 13 11:50:03 UTC 2010


>Number:         146544
>Category:       ports
>Synopsis:       Inkscape crashes when locale is enabled
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 13 11:50:03 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Joerg Wunsch
>Release:        FreeBSD 8.0-STABLE i386
>Organization:
>Environment:
System: FreeBSD remi.heep.sax.de 8.0-STABLE FreeBSD 8.0-STABLE #0: Tue Mar 9 16:43:26 CET 2010 root at remi.heep.sax.de:/usr/obj/usr/src/sys/REMI i386

>Description:
	When running in a localized environment, Inkscape has a
	tendency to crash with a message box

	"Inkscape encountered an internal error and will be
	terminated." (approximately, the original message was
	localized)

	It then writes a coredump.  Analyzing the coredump shows
	that std::locale::locale() throw an error, which eventually
	leads to an abort().

>How-To-Repeat:
	This can, for example, be simply triggered by trying to
	change the document orientation from portrait to landscape
	in the document properties dialog.

>Fix:

	In my opinion, Inkscape already implements the correct code
	in src/util/ucompose.hpp:

  inline Composition::Composition(std::string fmt)
    : arg_no(1)
  {
#if __GNUC__ >= 3
    try {
	os.imbue(std::locale("")); // use the user's locale for the stream
    }
    catch (std::runtime_error& e) { // fallback to classic if it failed
	os.imbue(std::locale::classic());
    }

	It first attempts to set the locale the "new way" (which
	is not supported at all under FreeBSD), and upon catching
	the exception, wants to revert to classic locales.

	When I use the following mini application:

#include <locale>
#include <stdexcept>

int
main(void)
{
  try {
   std::locale("");
  }
  catch (std::runtime_error &e) {
   std::locale::classic();
  }
   return 0;
}

	catching the exception works correctly.  For whatever
	reason (I did not find so far), catching the exception
	does not work in Inkscape though.

	As a quick hack, the following patch makes it work
	correctly:

--- src/util/ucompose.hpp~	2009-11-16 18:29:43.000000000 +0100
+++ src/util/ucompose.hpp	2010-05-13 12:15:30.000000000 +0200
@@ -183,13 +183,17 @@
     : arg_no(1)
   {
 #if __GNUC__ >= 3
+#if 0
     try {
 	os.imbue(std::locale("")); // use the user's locale for the stream
     } 
     catch (std::runtime_error& e) { // fallback to classic if it failed
+#endif
 	os.imbue(std::locale::classic());
+#if 0
     }
 #endif
+#endif
     std::string::size_type b = 0, i = 0;
   
     // fill in output with the strings between the %1 %2 %3 etc. and


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list