fix inkscape segmentation fault

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

fix inkscape segmentation fault

Rafael Sadowski
Hi everybody,

last days I debug inkscape. Could anybody reproduce my segfault on
amd64-current:

1.) starts inkscape
2.) Ctrl+F6 (select brush strokers)
3.) draw something
4.) change "Thinning" or an other value in the SpinButton/SpinBox in the
    menu-bar.
or

4.1)  Shift+Ctrl+F (This will trigger the GtkSpinButton)

If it crash, we need to convert the GtkSpinButton::get_text() in UTF-8 to
pass g_utf8_validate.

Best regards,

Rafael


Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/inkscape/Makefile,v
retrieving revision 1.47
diff -u -p -u -p -r1.47 Makefile
--- Makefile 29 Nov 2015 10:45:22 -0000 1.47
+++ Makefile 4 Feb 2016 20:12:12 -0000
@@ -7,7 +7,7 @@ COMMENT= SVG vector drawing application
 
 DISTNAME= inkscape-0.91
 CATEGORIES= graphics
-REVISION= 5
+REVISION= 6
 
 MASTER_SITES = https://inkscape.org/en/gallery/item/3854/
 HOMEPAGE= http://www.inkscape.org/
Index: patches/patch-src_util_expression-evaluator_cpp
===================================================================
RCS file: patches/patch-src_util_expression-evaluator_cpp
diff -N patches/patch-src_util_expression-evaluator_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_util_expression-evaluator_cpp 4 Feb 2016 20:12:12 -0000
@@ -0,0 +1,25 @@
+$OpenBSD$
+
+Fix g_utf8_validate call. get_text() from GtkSpinButton returns an
+string with a wrong encoding.
+
+--- src/util/expression-evaluator.cpp.orig Sun Nov 30 19:45:32 2014
++++ src/util/expression-evaluator.cpp Thu Feb  4 20:46:25 2016
+@@ -28,6 +28,8 @@
+ #include "util/expression-evaluator.h"
+ #include "util/units.h"
+
++#include <glib/gconvert.h>
++
+ #include <math.h>
+ #include <string.h>
+
+@@ -49,7 +51,7 @@ EvaluatorToken::EvaluatorToken()
+ }
+
+ ExpressionEvaluator::ExpressionEvaluator(const char *string, Unit const *unit) :
+-    string(string),
++    string(g_locale_to_utf8(string,-1,0,0,0)),
+     unit(unit)
+ {
+     current_token.type  = TOKEN_END;

Reply | Threaded
Open this post in threaded view
|

Re: fix inkscape segmentation fault

Stuart Henderson-6
On 2016/02/04 21:34, Rafael Sadowski wrote:

> Hi everybody,
>
> last days I debug inkscape. Could anybody reproduce my segfault on
> amd64-current:
>
> 1.) starts inkscape
> 2.) Ctrl+F6 (select brush strokers)
> 3.) draw something
> 4.) change "Thinning" or an other value in the SpinButton/SpinBox in the
>     menu-bar.
> or
>
> 4.1)  Shift+Ctrl+F (This will trigger the GtkSpinButton)
>
> If it crash, we need to convert the GtkSpinButton::get_text() in UTF-8 to
> pass g_utf8_validate.

Great, that is a lot better, it fixes the problem Laurie Tratt had too
(worked around with malloc flags 'j' to disable junking).

Unless there are objections I'll commit it soon, could you send it
upstream as well please?

Reply | Threaded
Open this post in threaded view
|

Re: fix inkscape segmentation fault

Rafael Sadowski
On Thu Feb 04, 2016 at 09:41:17PM +0000, Stuart Henderson wrote:

> On 2016/02/04 21:34, Rafael Sadowski wrote:
> > Hi everybody,
> >
> > last days I debug inkscape. Could anybody reproduce my segfault on
> > amd64-current:
> >
> > 1.) starts inkscape
> > 2.) Ctrl+F6 (select brush strokers)
> > 3.) draw something
> > 4.) change "Thinning" or an other value in the SpinButton/SpinBox in the
> >     menu-bar.
> > or
> >
> > 4.1)  Shift+Ctrl+F (This will trigger the GtkSpinButton)
> >
> > If it crash, we need to convert the GtkSpinButton::get_text() in UTF-8 to
> > pass g_utf8_validate.
>
> Great, that is a lot better, it fixes the problem Laurie Tratt had too
> (worked around with malloc flags 'j' to disable junking).
>
> Unless there are objections I'll commit it soon, could you send it
> upstream as well please?

Of course, will send upstream.

Happy Weekend,

Rafael

Reply | Threaded
Open this post in threaded view
|

Re: fix inkscape segmentation fault

Laurence Tratt
In reply to this post by Rafael Sadowski
On Thu, Feb 04, 2016 at 09:34:46PM +0100, Rafael Sadowski wrote:

Hello Rafael,

> last days I debug inkscape. Could anybody reproduce my segfault on
> amd64-current:

Yes, for me, inkscape was segfaulting all over the place, generally within 20
or 30 seconds of starting up (as Stuart mentioned, I managed to make it run
for a bit longer with MALLOC_OPTIONS, but even then it died fairly often).
With your patch, it no longer segfaults almost immediately, which is a very
promising sign! I think this patch definitely improves the situation on
OpenBSD. Thanks (particularly as I had got no further than running gdb on it
once)!


Laurie
--
Personal                                             http://tratt.net/laurie/
Software Development Team                                http://soft-dev.org/
   https://github.com/ltratt              http://twitter.com/laurencetratt