[gnome-commander] Fix memory leak in get_string_pixel_size
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Fix memory leak in get_string_pixel_size
- Date: Mon, 22 Aug 2016 19:48:39 +0000 (UTC)
commit 796b382fa2f73c3a4a7a00aaa1f809c50b52064a
Author: Eric R. Schulz <eric ers35 com>
Date: Wed Aug 17 21:22:09 2016 -0400
Fix memory leak in get_string_pixel_size
Use g_object_ref_sink() followed by g_object_unref() to properly set
the reference count.
src/gnome-cmd-dir-indicator.cc | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/gnome-cmd-dir-indicator.cc b/src/gnome-cmd-dir-indicator.cc
index 09e4ffd..e219a36 100644
--- a/src/gnome-cmd-dir-indicator.cc
+++ b/src/gnome-cmd-dir-indicator.cc
@@ -230,13 +230,12 @@ inline int get_string_pixel_size (const char *s, int len)
gchar *ms = get_mono_text (utf8buf);
gtk_label_set_markup (label, ms);
g_free (ms);
- g_object_ref (label);
+ g_object_ref_sink(G_OBJECT(label));
PangoLayout *layout = gtk_label_get_layout (label);
pango_layout_get_pixel_size (layout, &xSize, &ySize);
- // we're finished with the label
- gtk_object_sink (GTK_OBJECT (label));
+ g_object_unref(GTK_OBJECT (label));
g_free (utf8buf);
g_free (buf);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]