From 3999de8f59e82f0fb7a67bce75b92d68794b72db Mon Sep 17 00:00:00 2001 From: JosephMcc Date: Sun, 11 Mar 2018 04:38:24 -0700 Subject: [PATCH] xed-window: Fix a potential crash --- xed/xed-window.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xed/xed-window.c b/xed/xed-window.c index 84bd94a..af2bb91 100644 --- a/xed/xed-window.c +++ b/xed/xed-window.c @@ -497,7 +497,7 @@ received_clipboard_contents (GtkClipboard *clipboard, GtkSelectionData *selection_data, XedWindow *window) { - gboolean sens; + gboolean sensitive; GtkAction *action; /* getting clipboard contents is async, so we need to @@ -507,17 +507,23 @@ received_clipboard_contents (GtkClipboard *clipboard, { XedTabState state; gboolean state_normal; + state = xed_tab_get_state (window->priv->active_tab); state_normal = (state == XED_TAB_STATE_NORMAL); - sens = state_normal && gtk_selection_data_targets_include_text (selection_data); + sensitive = state_normal && gtk_selection_data_targets_include_text (selection_data); } else { - sens = FALSE; + sensitive = FALSE; } action = gtk_action_group_get_action (window->priv->action_group, "EditPaste"); - gtk_action_set_sensitive (action, sens); + + if (action != NULL) + { + gtk_action_set_sensitive (action, sensitive); + } + g_object_unref (window); }