[smuxi/stable] Frontend-GNOME: fix Gtk-CRITICAL messages when quitting



commit d21333da15eff65c37b2ca93492eeab07c709f5c
Author: Mirco Bauer <meebey meebey net>
Date:   Sun Jun 11 14:32:17 2017 +0800

    Frontend-GNOME: fix Gtk-CRITICAL messages when quitting
    
    When quitting Smuxi, the terminal that runs the frontend will show Gtk-CRITICAL
    messages like this:
    
        2017-06-11 14:31:35,035 [Main] DEBUG TRACE - [smuxi-frontend-gnome.exe] ChatViewManager.Clear()
        (smuxi-frontend-gnome:13501): Gtk-CRITICAL **: gtk_tree_store_get_path: assertion 'iter->user_data != 
NULL' failed
        (smuxi-frontend-gnome:13501): Gtk-CRITICAL **: IA__gtk_tree_model_get_iter: assertion 'path != NULL' 
failed
        2017-06-11 14:31:35,037 [Main] DEBUG TRACE - [smuxi-frontend-gnome.exe] 
ChatViewManager.OnTreeViewSelectionChanged(sender = Gtk.TreeSelection, e = System.EventArgs)
    
    This happens because the ChatTreeView.Selection.Changed event handler assumes
    there is always at least one item in the TreeView/Model which is not the case
    during the shutdown which is clearing all items. So the last removed chat then
    triggers this condition.

 src/Frontend-GNOME/Views/ChatTreeView.cs |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/Frontend-GNOME/Views/ChatTreeView.cs b/src/Frontend-GNOME/Views/ChatTreeView.cs
index bb5db29..aad567a 100644
--- a/src/Frontend-GNOME/Views/ChatTreeView.cs
+++ b/src/Frontend-GNOME/Views/ChatTreeView.cs
@@ -86,6 +86,10 @@ namespace Smuxi.Frontend.Gnome
                     Selection.SelectIter(iter);
                     return;
                 }
+                if (Gtk.TreeIter.Zero.Equals(iter)) {
+                    // no chat views available; this happens during shutdown
+                    return;
+                }
                 var path = TreeStore.GetPath(iter);
                 f_CurrentChatNumber = GetRowNumber(path);
             };


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