glib: do not call g_thread_ functions in GLib >= 2.31

Based on downstream patch by by Christopher James Halse Rogers <raof@ubuntu.com>
Should fix BXC#2329 reported by Sergey Litvinov.
This commit is contained in:
Andres G. Aragoneses 2012-05-03 23:45:07 +01:00
parent 645815d478
commit 3862bc75ec
3 changed files with 26 additions and 1 deletions

View file

@ -176,6 +176,11 @@ PKG_CHECK_MODULES(GIO, gio-2.0 >= $GLIB_REQUIRED_VERSION)
AC_SUBST(GIO_CFLAGS) AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS) AC_SUBST(GIO_LIBS)
PKG_CHECK_MODULES(GLIB_2_31,
glib-2.0 >= 2.31,
HAVE_GLIB_2_31_OR_HIGHER=yes, HAVE_GLIB_2_31_OR_HIGHER=no)
AM_CONDITIONAL(DISABLE_GTHREAD_CHECK, test "x$HAVE_GLIB_2_31_OR_HIGHER" = "xyes")
PKG_CHECK_MODULES(PANGO, pango) PKG_CHECK_MODULES(PANGO, pango)
AC_SUBST(PANGO_CFLAGS) AC_SUBST(PANGO_CFLAGS)
AC_SUBST(PANGO_LIBS) AC_SUBST(PANGO_LIBS)

View file

@ -81,9 +81,15 @@ EXTRA_DIST = \
glib-sharp-3.0.pc.in \ glib-sharp-3.0.pc.in \
glib-api.xml glib-api.xml
if DISABLE_GTHREAD_CHECK
BUILD_DEFINES=-define:DISABLE_GTHREAD_CHECK
else
BUILD_DEFINES=
endif
$(ASSEMBLY): $(build_sources) $(SNK) $(ASSEMBLY): $(build_sources) $(SNK)
@rm -f $(ASSEMBLY).mdb @rm -f $(ASSEMBLY).mdb
$(CSC) $(CSFLAGS) -keyfile:$(SNK) -unsafe -out:$(ASSEMBLY) -target:library $(references) $(build_sources) $(CSC) $(CSFLAGS) -keyfile:$(SNK) -unsafe -out:$(ASSEMBLY) -target:library $(references) $(build_sources) $(BUILD_DEFINES)
policy.%.config: $(top_builddir)/policy.config policy.%.config: $(top_builddir)/policy.config
sed -e "s/@ASSEMBLY_NAME@/$(ASSEMBLY_NAME)/" -e "s/@POLICY@/$*/" $(top_builddir)/policy.config > $@ sed -e "s/@ASSEMBLY_NAME@/$(ASSEMBLY_NAME)/" -e "s/@POLICY@/$*/" $(top_builddir)/policy.config > $@

View file

@ -28,6 +28,18 @@ namespace GLib
{ {
private Thread () {} private Thread () {}
#if DISABLE_GTHREAD_CHECK
public static void Init ()
{
// GLib automatically inits threads in 2.31 and above
// http://developer.gnome.org/glib/unstable/glib-Deprecated-Thread-APIs.html#g-thread-init
}
public static bool Supported
{
get { return true; }
}
#else
[DllImport ("libgthread-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgthread-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_thread_init (IntPtr i); static extern void g_thread_init (IntPtr i);
@ -45,5 +57,7 @@ namespace GLib
return g_thread_get_initialized (); return g_thread_get_initialized ();
} }
} }
#endif
} }
} }