summaryrefslogtreecommitdiff
path: root/src/terminal-window.c
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-12-18 23:31:07 +0100
committerRobert Antoni Buj Gelonch <[email protected]>2019-12-19 15:27:21 +0100
commit5cd597b04049206226fbfd4e5bb8016113c82952 (patch)
treec8f22e4eda9ab2a2c8b5e3e60357a724d3b1150b /src/terminal-window.c
parent9529b42518cd096c5d409cca09641aa876d86b18 (diff)
downloadmate-terminal-5cd597b04049206226fbfd4e5bb8016113c82952.tar.bz2
mate-terminal-5cd597b04049206226fbfd4e5bb8016113c82952.tar.xz
terminal-window: Fix memory leak
Gsettings needs to be freed
Diffstat (limited to 'src/terminal-window.c')
-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 f38ab43..1c56eae 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;
@@ -2208,7 +2210,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");
@@ -2228,9 +2230,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",
@@ -2415,6 +2417,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),
@@ -3570,7 +3573,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;
@@ -3583,9 +3585,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;