[Commits] [SCM] claws branch, master, updated. 3.16.0-252-ge44bcca
ticho at claws-mail.org
ticho at claws-mail.org
Fri Aug 3 13:23:51 CEST 2018
The branch, master has been updated
via e44bccaba2f23878087f5f628a073ce6bf70d17f (commit)
from 7f375eddc128a2b3c452a3965f7e0556e7e0b1c6 (commit)
Summary of changes:
src/mainwindow.c | 3 +--
src/toolbar.c | 21 +++++++++++++++------
2 files changed, 16 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit e44bccaba2f23878087f5f628a073ce6bf70d17f
Author: Andrej Kacian <ticho at claws-mail.org>
Date: Fri Aug 3 13:22:49 2018 +0200
Fix memory leaks in toolbar handling of alternate icons (mail/news, ham/spam).
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 3762981..8e87c70 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -3880,8 +3880,7 @@ void main_window_destroy_all(void)
/* free toolbar stuff */
toolbar_clear_list(TOOLBAR_MAIN);
- TOOLBAR_DESTROY_ACTIONS(mainwin->toolbar->action_list);
- TOOLBAR_DESTROY_ITEMS(mainwin->toolbar->item_list);
+ toolbar_destroy(mainwin->toolbar);
summaryview_destroy(mainwin->summaryview);
mainwin->folderview->mainwin = NULL;
diff --git a/src/toolbar.c b/src/toolbar.c
index 823a894..15b05b5 100644
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -2322,11 +2322,11 @@ Toolbar *toolbar_create(ToolbarType type,
_("Compose with selected Account"));
toolbar_data->compose_mail_btn = item;
toolbar_data->compose_mail_icon = icon_wid;
- g_object_ref(toolbar_data->compose_mail_icon);
+ g_object_ref_sink(toolbar_data->compose_mail_icon);
icon_news = stock_pixmap_widget(STOCK_PIXMAP_NEWS_COMPOSE);
toolbar_data->compose_news_icon = icon_news;
- g_object_ref(toolbar_data->compose_news_icon);
+ g_object_ref_sink(toolbar_data->compose_news_icon);
#else
TOOLBAR_ITEM(item,icon_wid,toolbar_item->text,
_("Compose Email"));
@@ -2343,11 +2343,11 @@ Toolbar *toolbar_create(ToolbarType type,
_("Learn as..."));
toolbar_data->learn_spam_btn = item;
toolbar_data->learn_spam_icon = icon_wid;
- g_object_ref(toolbar_data->learn_spam_icon);
+ g_object_ref_sink(toolbar_data->learn_spam_icon);
icon_ham = stock_pixmap_widget(STOCK_PIXMAP_HAM_BTN);
toolbar_data->learn_ham_icon = icon_ham;
- g_object_ref(toolbar_data->learn_ham_icon);
+ g_object_ref_sink(toolbar_data->learn_ham_icon);
menu = gtk_menu_new();
ADD_MENU_ITEM(_("Learn as _Spam"), toolbar_learn_menu_cb, TRUE);
@@ -2609,13 +2609,22 @@ Toolbar *toolbar_create(ToolbarType type,
/**
* Free toolbar structures
- */
-void toolbar_destroy(Toolbar * toolbar) {
+ */
+#define UNREF_ICON(icon) if (toolbar->icon != NULL) \
+ g_object_unref(toolbar->icon)
+
+void toolbar_destroy(Toolbar * toolbar) {
+ UNREF_ICON(compose_mail_icon);
+ UNREF_ICON(compose_news_icon);
+ UNREF_ICON(learn_spam_icon);
+ UNREF_ICON(learn_ham_icon);
TOOLBAR_DESTROY_ITEMS(toolbar->item_list);
TOOLBAR_DESTROY_ACTIONS(toolbar->action_list);
}
+#undef UNREF_ICON
+
void toolbar_update(ToolbarType type, gpointer data)
{
Toolbar *toolbar_data;
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list