[gtkmm-documentation] treeview/drag_and_drop example: Fix a comment



commit 4d4d018be5a68ce86a2cd7fd6a55de06dd7dd097
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Wed Mar 8 09:37:25 2017 +0100

    treeview/drag_and_drop example: Fix a comment
    
    The 'model' output parameter in Gtk::TreePath::get_from_selection_data()
    is now a Glib::RefPtr<const TreeModel>&. Now, and previously when it was a
    Glib::RefPtr<TreeModel>&, it's an output parameter (not input and output).
    It can be an empty RefPtr when get_from_selection_data() is called.
    There's no reason to make a RefPtr to 'this'.

 .../book/treeview/drag_and_drop/treemodel_dnd.cc   |   23 +++++++++----------
 1 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/examples/book/treeview/drag_and_drop/treemodel_dnd.cc 
b/examples/book/treeview/drag_and_drop/treemodel_dnd.cc
index 5de726f..a85657a 100644
--- a/examples/book/treeview/drag_and_drop/treemodel_dnd.cc
+++ b/examples/book/treeview/drag_and_drop/treemodel_dnd.cc
@@ -77,18 +77,17 @@ TreeModel_Dnd::row_drop_possible_vfunc(const Gtk::TreeModel::Path& dest,
     }
   }
 
-  //You could also examine the row being dragged (via selection_data)
-  //if you must look at both rows to see whether a drop should be allowed.
-  //You could use
-  //TODO: Add const version of get_from_selection_data(): Glib::RefPtr<const
-  //Gtk::TreeModel> refThis = Glib::RefPtr<const Gtk::TreeModel>(this);
-  //
-  //auto refThis =
-  //Glib::RefPtr<Gtk::TreeModel>(const_cast<TreeModel_Dnd*>(this));
-  //refThis->reference(); //, true /* take_copy */)
-  //Gtk::TreeModel::Path path_dragged_row;
-  //Gtk::TreeModel::Path::get_from_selection_data(selection_data, refThis,
-  //path_dragged_row);
+  // You could also examine the row being dragged (via selection_data)
+  // if you must look at both rows to see whether a drop should be allowed.
+  // You could use
+  //   Glib::RefPtr<const Gtk::TreeModel> model_dragged_row;
+  //   Gtk::TreeModel::Path path_dragged_row;
+  //   Gtk::TreeModel::Path::get_from_selection_data(selection_data,
+  //     model_dragged_row, path_dragged_row);
+  // This is risky, though. If the row being dragged, and thus selection_data,
+  // does not originate in the process that's calling get_from_selection_data(),
+  // you'll most likely get a segmentation fault. See the documentation of
+  // Gtk::TreePath::get_from_selection_data() or gtk_tree_get_row_drag_data().
 
   return Gtk::TreeStore::row_drop_possible_vfunc(dest, selection_data);
 }


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