[gtkmm/gtkmm-3-24] Gtk: Fix ownership of some GLists



commit ee63cdb4737dd338d96e4b0f0d995f4863bc13e1
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Wed Jul 24 09:12:16 2019 +0200

    Gtk: Fix ownership of some GLists
    
    * gtk/src/icontheme.ccg: list_icons(): Glib::OWNERSHIP_SHALLOW -> DEEP
    * gtk/src/iconview.hg: get_selected_icons(): SHALLOW -> DEEP. Remove the
    TreePathTraits struct in iconview.hg. Use the one in treepath.hg.
    * gtk/src/recentmanager.hg: get_items(): SHALLOW -> DEEP

 gtk/src/icontheme.ccg    |  4 +---
 gtk/src/iconview.hg      | 18 +-----------------
 gtk/src/recentmanager.hg |  3 +--
 3 files changed, 3 insertions(+), 22 deletions(-)
---
diff --git a/gtk/src/icontheme.ccg b/gtk/src/icontheme.ccg
index de6ddda9..e6904449 100644
--- a/gtk/src/icontheme.ccg
+++ b/gtk/src/icontheme.ccg
@@ -46,9 +46,7 @@ std::vector<int> IconTheme::get_icon_sizes(const Glib::ustring& icon_name) const
 
 std::vector<Glib::ustring> IconTheme::list_icons() const
 {
-  return 
Glib::ListHandler<Glib::ustring>::list_to_vector(gtk_icon_theme_list_icons(const_cast<GtkIconTheme*>(gobj()), 
nullptr /* means all icons according to the C documentation. */ ), Glib::OWNERSHIP_SHALLOW);
+  return 
Glib::ListHandler<Glib::ustring>::list_to_vector(gtk_icon_theme_list_icons(const_cast<GtkIconTheme*>(gobj()), 
nullptr /* means all icons according to the C documentation. */ ), Glib::OWNERSHIP_DEEP);
 }
 
-
 } // namespace Gtk
-
diff --git a/gtk/src/iconview.hg b/gtk/src/iconview.hg
index dd1589d3..cd078f50 100644
--- a/gtk/src/iconview.hg
+++ b/gtk/src/iconview.hg
@@ -172,23 +172,7 @@ public:
   _WRAP_METHOD(int get_item_row(const TreeModel::Path& path) const, gtk_icon_view_get_item_row)
   _WRAP_METHOD(int get_item_column(const TreeModel::Path& path) const, gtk_icon_view_get_item_column)
 
-
-  #ifndef DOXYGEN_SHOULD_SKIP_THIS
-  //TODO: I'm not sure about these to_*() functions. murrayc.
-  struct TreePathTraits
-  {
-    typedef TreePath  CppType;
-    typedef const GtkTreePath* CType;
-    typedef GtkTreePath*    CTypeNonConst;
-
-    static CType   to_c_type      (const CppType& obj) { return obj.gobj(); }
-    static CType   to_c_type      (const CType&   obj) { return obj; }
-    static CppType to_cpp_type    (const CType&   obj) { return CppType(const_cast<CTypeNonConst>(obj), 
true); }
-    static void    release_c_type (const CType&)       {}
-  };
-  #endif //DOXYGEN_SHOULD_SKIP_THIS
-
-#m4 _CONVERSION(`GList*',`std::vector<TreePath>',`Glib::ListHandler<TreePath, 
TreePathTraits>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
+#m4 _CONVERSION(`GList*',`std::vector<TreePath>',`Glib::ListHandler<TreePath, 
TreePathTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
   _WRAP_METHOD(std::vector<TreePath> get_selected_items() const, gtk_icon_view_get_selected_items)
 
   _WRAP_METHOD(void select_all(), gtk_icon_view_select_all)
diff --git a/gtk/src/recentmanager.hg b/gtk/src/recentmanager.hg
index 5780d239..e16e7fd8 100644
--- a/gtk/src/recentmanager.hg
+++ b/gtk/src/recentmanager.hg
@@ -121,8 +121,7 @@ public:
   _WRAP_METHOD(bool has_item(const Glib::ustring& uri) const, gtk_recent_manager_has_item)
   _WRAP_METHOD(bool move_item(const Glib::ustring& uri, const Glib::ustring& new_uri), 
gtk_recent_manager_move_item, errthrow)
 
-#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<RecentInfo> 
',`Glib::ListHandler<Glib::RefPtr<RecentInfo>, RecentInfoTraits>::list_to_vector($3, 
Glib::OWNERSHIP_SHALLOW)')
-
+#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<RecentInfo> 
',`Glib::ListHandler<Glib::RefPtr<RecentInfo>, RecentInfoTraits>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
   _WRAP_METHOD(std::vector<Glib::RefPtr<RecentInfo> > get_items() const, gtk_recent_manager_get_items)
 
   _WRAP_METHOD(int purge_items(), gtk_recent_manager_purge_items, errthrow)


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