[glibmm/glibmm-2-32] ContentType: get_icon(): Fix a refcount error.



commit 53eb53872cacc7f8f007ffa4e958b0a640cd92af
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 |    7 ++++---
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 26eafc2..e8482ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-09-07  Murray Cumming  <murrayc murrayc com>
+
+	ContentType: get_icon(): Fix a refcount error.
+
+	* gio/giomm/contenttype.cc: get_icon(): Take a reference.
+
 2.32.1:
 
 2012-07-10  Krzesimir Nowak  <qdlacz gmail com>
diff --git a/gio/giomm/contenttype.cc b/gio/giomm/contenttype.cc
index c0c3a49..f46534b 100644
--- a/gio/giomm/contenttype.cc
+++ b/gio/giomm/contenttype.cc
@@ -50,9 +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)
 {
-  //TODO: Does g_content_type_get_icon() return a reference?
-  //It currently has no implementation so it's hard to know. murrayc.
-  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;
 }
 
 bool content_type_can_be_executable(const Glib::ustring& type)



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