After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 87915 - pango_[win32|ft2]_shutdown_display() lack a NULL pointer check
pango_[win32|ft2]_shutdown_display() lack a NULL pointer check
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
1.0.x
Other Linux
: Normal normal
: 1.0.4
Assigned To: Owen Taylor
Owen Taylor
Depends on:
Blocks:
 
 
Reported: 2002-07-11 12:37 UTC by Sven Neumann
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch that adds the missing checks to the shutdown methods (1.34 KB, patch)
2002-07-11 12:38 UTC, Sven Neumann
none Details | Review

Description Sven Neumann 2002-07-11 12:37:19 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.
Comment 1 Sven Neumann 2002-07-11 12:38:23 UTC
Created attachment 9805 [details] [review]
patch that adds the missing checks to the shutdown methods
Comment 2 Sven Neumann 2002-07-11 13:20:57 UTC
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?
Comment 3 Sven Neumann 2002-07-16 15:49:11 UTC
I haven't received a response yet. Please consider this patch for 1.0.4.
Comment 4 Owen Taylor 2002-07-25 15:50:02 UTC
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().