[smuxi/stable] Frontend-GNOME: handle empty TreeView/Store in ChatTreeView gracefully
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi/stable] Frontend-GNOME: handle empty TreeView/Store in ChatTreeView gracefully
- Date: Sun, 11 Jun 2017 06:49:36 +0000 (UTC)
commit 0f9cb3f504d542e7b3d734efe99546d7635ab966
Author: Mirco Bauer <meebey meebey net>
Date: Sun Jun 11 14:43:10 2017 +0800
Frontend-GNOME: handle empty TreeView/Store in ChatTreeView gracefully
ChatTreeView.set_CurrentChatView() and GetPath(rowNumber) are ignoring the
result of TreeStore.GetIterFirst() which might fail and thus iter remains
Gtk.TreeIter.Zero which then would trigger Gtk-CRITICAL messages for the
following method calls on that Zero iter.
src/Frontend-GNOME/Views/ChatTreeView.cs | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/Frontend-GNOME/Views/ChatTreeView.cs b/src/Frontend-GNOME/Views/ChatTreeView.cs
index e51b4d3..2e87e37 100644
--- a/src/Frontend-GNOME/Views/ChatTreeView.cs
+++ b/src/Frontend-GNOME/Views/ChatTreeView.cs
@@ -43,7 +43,10 @@ namespace Smuxi.Frontend.Gnome
set {
Gtk.TreeIter iter;
if (value == null) {
- TreeStore.GetIterFirst(out iter);
+ if (!TreeStore.GetIterFirst(out iter)) {
+ // no chat views available; this can happen on shutdown
+ return;
+ }
} else {
iter = FindChatIter(value);
if (Gtk.TreeIter.Zero.Equals(iter)) {
@@ -508,7 +511,9 @@ namespace Smuxi.Frontend.Gnome
Gtk.TreePath GetPath(int rowNumber)
{
Gtk.TreeIter iter;
- TreeStore.GetIterFirst(out iter);
+ if (!TreeStore.GetIterFirst(out iter)) {
+ return null;
+ }
var path = TreeStore.GetPath(iter);
// TODO: clamp upper limit
int i;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]