diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-06-23 09:31:06 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-06-23 13:12:51 -0400 |
commit | e5b62c8c27599699fa583a18e5346138799d9f50 (patch) | |
tree | 60dc24aa32d0b3baa87c9f77ec1e06fa8164cd2f /pango/pango-context.c | |
parent | 6486619c1852021e204bda6cd79756a1aa8d7a9d (diff) | |
download | pango-e5b62c8c27599699fa583a18e5346138799d9f50.tar.gz |
Add a check for mixed linkageprevent-mixed-linkage
Having both pango 1.x and pango 2 linked into
the same process will cause trouble, because the
type and function names conflict.
Error out if we detect this situation.
Diffstat (limited to 'pango/pango-context.c')
-rw-r--r-- | pango/pango-context.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c index d5e73cfe..a7444865 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -23,6 +23,8 @@ #include <string.h> #include <stdlib.h> +#include <gio/gio.h> + #include "pango-context.h" #include "pango-context-private.h" #include "pango-impl-utils.h" @@ -80,11 +82,33 @@ pango_context_init (PangoContext *context) pango_font_description_set_size (context->font_desc, 12 * PANGO_SCALE); } +static gboolean +pango_has_mixed_deps (void) +{ + GModule *module; + gpointer func; + gboolean result = FALSE; + + module = g_module_open (NULL, 0); + + if (g_module_symbol (module, "pango_hb_font_new", &func)) + result = TRUE; + + g_module_close (module); + + return result; +} + static void pango_context_class_init (PangoContextClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + /* Put the check for mixed linkage here, for lack of a better place */ + if (pango_has_mixed_deps ()) + g_error ("Pango 2 symbols detected.\n" + "Using Pango 1.x and 2 in the same process is not supported."); + object_class->finalize = pango_context_finalize; } |