summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-12-18 23:31:07 +0100
committermonsta <[email protected]>2020-01-09 14:39:11 +0300
commitecb876d2037e0ffe072a2f75d1f2c8730c34cf08 (patch)
treef674dc51995ec6e872020c5cb989a07dcadfc010
parent95212c7ea07c7d2e48573b5cb9c62a39b5d9a321 (diff)
downloadmate-terminal-ecb876d2037e0ffe072a2f75d1f2c8730c34cf08.tar.bz2
mate-terminal-ecb876d2037e0ffe072a2f75d1f2c8730c34cf08.tar.xz
terminal-window: Fix memory leak
Gsettings needs to be freed
-rw-r--r--src/terminal-window.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c
index df6347c..9136041 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -52,6 +52,8 @@ struct _TerminalWindowPrivate
GtkUIManager *ui_manager;
guint ui_id;
+ GSettings *global_settings;
+
GtkActionGroup *profiles_action_group;
guint profiles_ui_id;
@@ -2145,7 +2147,7 @@ terminal_window_init (TerminalWindow *window)
GtkStyleContext *context;
- GSettings *settings = g_settings_new ("org.mate.terminal.global");
+ priv->global_settings = g_settings_new (CONF_GLOBAL_SCHEMA);
context = gtk_widget_get_style_context (GTK_WIDGET (window));
gtk_style_context_add_class (context, "mate-terminal");
@@ -2165,9 +2167,9 @@ terminal_window_init (TerminalWindow *window)
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
gtk_notebook_set_group_name (GTK_NOTEBOOK (priv->notebook), I_("mate-terminal-window"));
g_signal_connect (priv->notebook, "button-press-event",
- G_CALLBACK (notebook_button_press_cb), settings);
+ G_CALLBACK (notebook_button_press_cb), priv->global_settings);
g_signal_connect (window, "key-press-event",
- G_CALLBACK (window_key_press_cb), settings);
+ G_CALLBACK (window_key_press_cb), priv->global_settings);
g_signal_connect (priv->notebook, "popup-menu",
G_CALLBACK (notebook_popup_menu_cb), window);
g_signal_connect_after (priv->notebook, "switch-page",
@@ -2350,6 +2352,7 @@ terminal_window_finalize (GObject *object)
TerminalWindowPrivate *priv = window->priv;
g_object_unref (priv->ui_manager);
+ g_object_unref (priv->global_settings);
if (priv->confirm_close_dialog)
gtk_dialog_response (GTK_DIALOG (priv->confirm_close_dialog),
@@ -3499,7 +3502,6 @@ confirm_close_window_or_tab (TerminalWindow *window,
{
TerminalWindowPrivate *priv = window->priv;
GtkWidget *dialog;
- GSettings *settings;
gboolean do_confirm;
gboolean has_processes;
int n_tabs;
@@ -3512,9 +3514,8 @@ confirm_close_window_or_tab (TerminalWindow *window,
GTK_RESPONSE_DELETE_EVENT);
}
- settings = g_settings_new (CONF_GLOBAL_SCHEMA);
- do_confirm = g_settings_get_boolean (settings, "confirm-window-close");
- g_object_unref (settings);
+ do_confirm = g_settings_get_boolean (priv->global_settings, "confirm-window-close");
+
if (!do_confirm)
return FALSE;