[gnote] Fix a crash in the recent notes when clicking on the empty space. (Closes #586081)



commit 04a231a7ad28b75e679b562349afb3780bae78c9
Author: Hubert Figuiere <hub figuiere net>
Date:   Fri Jun 19 19:55:58 2009 -0400

    Fix a crash in the recent notes when clicking on the empty space. (Closes #586081)

 NEWS                  |    2 ++
 src/recentchanges.cpp |   12 ++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 49c60d2..17fb5b6 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ Fixes:
   * Fix a regression in the URL detection introduced in 0.5.0
     when the URL is in a list or withing text with non-ASCII
     characters.
+  * Fix a crash in the recent notes when clicking on the empty
+    space. (Closes #586081)
 
 Translations:
 
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index ddeb167..c4aa77c 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -768,7 +768,10 @@ namespace gnote {
                   
     m_tree->get_path_at_pos (ev->x, ev->y,
                              dest_path, column, unused, unused);
-    if (dest_path.empty())
+    // we need to test gobj() isn't NULL.
+    // See Gtkmm bug 586437
+    // https://bugzilla.gnome.org/show_bug.cgi?id=586437
+    if (dest_path.empty() || !dest_path.gobj())
       return false;
                   
     m_clickX = ev->x;
@@ -785,7 +788,12 @@ namespace gnote {
                     
       m_tree->get_selection()->unselect_all ();
       m_tree->get_selection()->select(dest_path);
-      m_tree->row_activated(dest_path, *column);
+      // apparently Gtk::TreeView::row_activated() require a dest_path
+      // while get_path_at_pos() can return a NULL pointer.
+      // See Gtkmm bug 586438
+      // https://bugzilla.gnome.org/show_bug.cgi?id=586438
+      gtk_tree_view_row_activated(m_tree->gobj(), dest_path.gobj(), 
+                                  column?column->gobj():NULL);
       break;
     case GDK_BUTTON_PRESS:
       if (ev->button == 3) {



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