From 88a1ee240da6f42f382e802949af4c78a5d42f33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Tue, 3 Nov 2020 13:16:56 -0500 Subject: [PATCH] conversationsview: avoid leaking model gtk_tree_view_set_model doesn't unref model, should be unref. Change-Id: I862eb4255ed9f0f2e01c7a958eb5e6be3e851cc8 GitLab: #1215 --- src/conversationsview.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/conversationsview.cpp b/src/conversationsview.cpp index f9e664e9..fa2a8831 100644 --- a/src/conversationsview.cpp +++ b/src/conversationsview.cpp @@ -659,6 +659,7 @@ build_conversations_view(ConversationsView *self) auto model = create_and_fill_model(self); gtk_tree_view_set_model(GTK_TREE_VIEW(self), GTK_TREE_MODEL(model)); + g_object_unref(model); gtk_tree_view_set_enable_search(GTK_TREE_VIEW(self), false); @@ -713,6 +714,7 @@ build_conversations_view(ConversationsView *self) gtk_tree_view_set_model(GTK_TREE_VIEW(self), GTK_TREE_MODEL(model)); + g_object_unref(model); }); @@ -724,6 +726,7 @@ build_conversations_view(ConversationsView *self) gtk_tree_view_set_model(GTK_TREE_VIEW(self), GTK_TREE_MODEL(model)); + g_object_unref(model); }); priv->searchStatusChangedConnection_ = QObject::connect( &*(*priv->accountInfo_)->conversationModel, @@ -783,6 +786,7 @@ build_conversations_view(ConversationsView *self) gtk_tree_view_set_model(GTK_TREE_VIEW(self), GTK_TREE_MODEL(model)); + g_object_unref(model); }); priv->callChangedConnection_ = QObject::connect( @@ -801,6 +805,7 @@ build_conversations_view(ConversationsView *self) // create updated model auto new_model = create_and_fill_model(self); gtk_tree_view_set_model(GTK_TREE_VIEW(self), GTK_TREE_MODEL(new_model)); + g_object_unref(new_model); // make sure conversation remains selected conversations_view_select_conversation(self, conversationUid); -- GitLab