[prev in list] [next in list] [prev in thread] [next in thread]
List: gnuplot-info-beta
Subject: Re: GLib version requirement
From: sfeam via gnuplot-beta <gnuplot-beta () lists ! sourceforge ! net>
Date: 2018-05-10 16:00:27
Message-ID: 1655337.JPza3S8DI1 () stonelion
[Download RAW message or body]
On Thursday, 10 May 2018 09:31:32 Allin Cottrell wrote:
> I see that since 2017-02-09 gnuplot requires version 2.28 or higher of
> GLib, on account of use of the macro g_clear_object.
>
> Unfortunately it can be difficult to build GLib on (or for) some older
> systems, such as OS X <= 10.4, but older GLib versions are easier
> (e.g. 2.18). I'd like to suggest pushing the GLib dependency back to
> 2.18 and adding a simple compatibility macro in gp_cairo.c. Here's an
> illustrative diff relative to 5.2.3:
>
> --- gp_cairo.c.orig 2018-05-09 16:46:59.510301745 -0400
> +++ gp_cairo.c 2018-05-10 08:32:07.378541918 -0400
> @@ -77,6 +77,13 @@
> #define rint(x) floor((x)+0.5L)
> #endif
>
> +#if GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 28
> +#define g_clear_object(op) \
> + { gpointer *_p = (gpointer) (op); \
> + if (_p && *_p) { g_object_unref(*_p); *_p = NULL; } \
> + }
> +#endif
> +
> /* undef this to see what happens without the Symbol-to-unicode processing */
> #define MAP_SYMBOL
>
> Any thoughts?
The change to use g_clear_object fixed detectable use-after-free errors.
Your proposed macro goes back to calling g_object_unref without any
separate reference counting, so I imagine it would reintroduce the
use-after-free errors. Have you checked? Or maybe the need for
reference counting was introduced in some later version of glib?
Ethan
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@lists.sourceforge.net
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic