[balsa] Various: Check for NULL GtkTreePath
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] Various: Check for NULL GtkTreePath
- Date: Sun, 30 Aug 2020 18:55:31 +0000 (UTC)
commit 3ca4acf0883b7adc22d62b8059cf6a22eb980b85
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sun Aug 30 14:53:05 2020 -0400
Various: Check for NULL GtkTreePath
Check the path returned by gtk_tree_row_reference_get_path(), as it can
be NULL.
modified: libbalsa/address-view.c
modified: src/balsa-index.c
libbalsa/address-view.c | 20 +++++++++++++-------
src/balsa-index.c | 12 ++++++++----
2 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/libbalsa/address-view.c b/libbalsa/address-view.c
index 5a27c4dd1..817b34617 100644
--- a/libbalsa/address-view.c
+++ b/libbalsa/address-view.c
@@ -271,10 +271,12 @@ lbav_ensure_blank_line_idle_cb(LibBalsaAddressView * address_view)
gtk_tree_row_reference_free(address_view->focus_row);
address_view->focus_row = NULL;
- /* This will open the entry for editing */
- gtk_tree_view_set_cursor(GTK_TREE_VIEW(address_view), focus_path,
- address_view->focus_column, TRUE);
- gtk_tree_path_free(focus_path);
+ if (focus_path != NULL) {
+ /* This will open the entry for editing */
+ gtk_tree_view_set_cursor(GTK_TREE_VIEW(address_view), focus_path,
+ address_view->focus_column, TRUE);
+ gtk_tree_path_free(focus_path);
+ }
address_view->focus_idle_id = 0;
@@ -1160,14 +1162,18 @@ libbalsa_address_view_add_to_row(LibBalsaAddressView * address_view,
GtkTreePath *path;
GtkTreeIter iter;
guint type;
- gboolean valid;
+ gboolean valid = FALSE;
g_return_if_fail(LIBBALSA_IS_ADDRESS_VIEW(address_view));
model = gtk_tree_view_get_model(GTK_TREE_VIEW(address_view));
+
path = gtk_tree_row_reference_get_path(row_ref);
- valid = gtk_tree_model_get_iter(model, &iter, path);
- gtk_tree_path_free(path);
+ if (path != NULL) {
+ valid = gtk_tree_model_get_iter(model, &iter, path);
+ gtk_tree_path_free(path);
+ }
+
if (!valid)
return;
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 41fbdff28..bf435ef9d 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -865,8 +865,10 @@ bndx_scroll_to_row_idle(gpointer user_data)
gtk_tree_row_reference_free(bindex->reference);
bindex->reference = NULL;
- gtk_tree_view_scroll_to_cell(tree_view, path, NULL, FALSE, 0, 0);
- gtk_tree_path_free(path);
+ if (path != NULL) {
+ gtk_tree_view_scroll_to_cell(tree_view, path, NULL, FALSE, 0, 0);
+ gtk_tree_path_free(path);
+ }
bindex->scroll_to_row_idle_id = 0;
@@ -1393,8 +1395,10 @@ bndx_expand_to_row_and_select_idle(BalsaIndex *bindex)
gtk_tree_row_reference_free(bindex->reference);
bindex->reference = NULL;
- bndx_select_row(bindex, path);
- gtk_tree_path_free(path);
+ if (path != NULL) {
+ bndx_select_row(bindex, path);
+ gtk_tree_path_free(path);
+ }
return G_SOURCE_REMOVE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]