[glibmm] ContentType: get_icon(): Fix a refcount error.



commit 1d1f273575fe1db4ed721e0bd3badaacdfcb8ab0
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Sep 7 09:44:40 2012 +0200

    ContentType: get_icon(): Fix a refcount error.
    
    * gio/giomm/contenttype.cc: get_icon(): Take a reference.

 ChangeLog                |    6 ++++++
 gio/giomm/contenttype.cc |    5 ++++-
 2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f618de1..bc20047 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2012-09-07  Murray Cumming  <murrayc murrayc com>
 
+	ContentType: get_icon(): Fix a refcount error.
+
+	* gio/giomm/contenttype.cc: get_icon(): Take a reference.
+
+2012-09-07  Murray Cumming  <murrayc murrayc com>
+
 	MenuItem: Add get_link().
 
 	* gio/src/menuitem.hg: Wrap g_menu_item_get_link().
diff --git a/gio/giomm/contenttype.cc b/gio/giomm/contenttype.cc
index b48840a..6c3806b 100644
--- a/gio/giomm/contenttype.cc
+++ b/gio/giomm/contenttype.cc
@@ -50,7 +50,10 @@ Glib::ustring content_type_get_mime_type(const Glib::ustring& type)
 
 Glib::RefPtr<Gio::Icon> content_type_get_icon(const Glib::ustring& type)
 {
-  return Glib::wrap(g_content_type_get_icon(type.c_str()));
+ Glib::RefPtr<Icon> retvalue = Glib::wrap(g_content_type_get_icon(type.c_str()));
+  if(retvalue)
+    retvalue->reference(); //The function does not do a ref for us.
+  return retvalue;
 }
 
 Glib::RefPtr<Gio::Icon> content_type_get_symbloic_icon(const Glib::ustring& type)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]