summaryrefslogtreecommitdiff
path: root/modules/basic/basic-win32.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2002-11-12 04:07:07 +0000
committerTor Lillqvist <tml@src.gnome.org>2002-11-12 04:07:07 +0000
commit4b14c577617509ee04d34e8ec6dd9e759df75be0 (patch)
tree45f4045bff4ed5bb11f213b087cdc3c0f1150155 /modules/basic/basic-win32.c
parent8d352139536682bf58b5a25a42b1f35d5f058ade (diff)
downloadpango-4b14c577617509ee04d34e8ec6dd9e759df75be0.tar.gz
Add more debugging output.
2002-11-12 Tor Lillqvist <tml@iki.fi> * pango/pangowin32-fontcache.c (free_cache_entry, cache_entry_unref, pango_win32_font_cache_load): Add more debugging output. * modules/basic/basic-win32.c (uniscribe_shape): Plug memory leak: Free return value from pango_win32_font_logfont(). Call pango_win32_font_cache_unload() for the hfont returned from pango_win32_font_cache_load() after using it.
Diffstat (limited to 'modules/basic/basic-win32.c')
-rw-r--r--modules/basic/basic-win32.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/modules/basic/basic-win32.c b/modules/basic/basic-win32.c
index f2dedd98..1b5cf8b2 100644
--- a/modules/basic/basic-win32.c
+++ b/modules/basic/basic-win32.c
@@ -835,7 +835,8 @@ uniscribe_shape (PangoFont *font,
int wlen, i;
gboolean retval = TRUE;
GError *error;
- HGDIOBJ old_font;
+ HGDIOBJ old_font = NULL;
+ HFONT hfont = NULL;
LOGFONT *lf;
SCRIPT_CACHE script_cache[100];
@@ -847,7 +848,15 @@ uniscribe_shape (PangoFont *font,
wlen /= 2;
lf = pango_win32_font_logfont (font);
- old_font = SelectObject (hdc, pango_win32_font_cache_load (font_cache, lf));
+ hfont = pango_win32_font_cache_load (font_cache, lf);
+ g_free (lf);
+
+ if (hfont == NULL)
+ retval = FALSE;
+
+ if (retval)
+ old_font = SelectObject (hdc, hfont);
+
if (old_font == NULL)
{
#ifdef BASIC_WIN32_DEBUGGING
@@ -887,6 +896,9 @@ uniscribe_shape (PangoFont *font,
if (old_font != NULL)
SelectObject (hdc, old_font);
+ if (hfont != NULL)
+ pango_win32_font_cache_unload (font_cache, hfont);
+
return retval;
}