GNOME Bugzilla – Bug 87915
pango_[win32|ft2]_shutdown_display() lack a NULL pointer check
Last modified: 2004-12-22 21:47:04 UTC
IMHO pango_ft2_shutdown_display() and pango_win32_shutdown_display() should check if the fontmap exists before they try to clear and unref them. I will attach a simple patch that adds these missing checks. I also wonder if pango_win32_fontmap_cache_clear() and pango_ft2_font_map_cache_clear() shouldn't be called from the fontmap finalizer so that the cache is always cleared.
Created attachment 9805 [details] [review] patch that adds the missing checks to the shutdown methods
To explain the importance of this little patch, here are a few lines of code that crash in pango_ft2_shutdown_display() when compiled against GTK+-DirectFB (and probably GTK+-Win32): #include <gtk/gtk.h> int main (int argc, char *argv[]) { gtk_init (&argc, &argv); _gdk_windowing_exit(); return 0; } Yes I know that I shouldn't call _gdk_windowing_exit() directly but unfortunately this seems to be the only way to execute the GDK shutdown code. Or is there another way?
I haven't received a response yet. Please consider this patch for 1.0.4.
Applied. Thu Jul 25 11:42:17 2002 Owen Taylor <otaylor@redhat.com> * pango/pangoft2-fontmap.c (pango_ft2_shutdown_display) * pango/pangowin32-fontmap.c (pango_win32_shutdown_display): Handle checking for fontmap == NULL and setting it to NULL after unrefing properly. (#87915, Sven Neumann) Couple of notes: * There is *no* way in GTK+-2.0.0 to shutdown the windowing code. _gtk_windowing_exit() is simply an unused interanl function. (And it isn't that you "aren't supposed" to call _gtk_windowing_exit(). You *can't*, except for a bug in libtool on Linux when doing shared linking.) * In Pango-1.2, pango_ft2_shutdown_display(), pango_ft2_font_map_for_display(), pango_ft2_get_context() are effectively deprecated in favor of pango_ft2_fontmap_new(), g_object_unref(),\ pango_ft2_font_map_create_context().