From 9e4cdff7752304fff978ab7f606b64ea85310baf Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Wed, 21 Mar 2018 14:28:06 +1100 Subject: Fix some runtime warnings caused by previous change as wSelection created later and clients (such as SciTE's about box) may use API to set up text before window is realized. --- gtk/ScintillaGTK.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index d285508d2..de1c3e727 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -1329,15 +1329,15 @@ void ScintillaGTK::AddToPopUp(const char *label, int cmd, bool enabled) { } bool ScintillaGTK::OwnPrimarySelection() { - return ((gdk_selection_owner_get(GDK_SELECTION_PRIMARY) - == PWindow(wSelection)) && - (PWindow(wSelection) != NULL)); + return (wSelection.Created() && + (gdk_selection_owner_get(GDK_SELECTION_PRIMARY) == PWindow(wSelection)) && + (PWindow(wSelection) != NULL)); } void ScintillaGTK::ClaimSelection() { // X Windows has a 'primary selection' as well as the clipboard. // Whenever the user selects some text, we become the primary selection - if (!sel.Empty() && IS_WIDGET_REALIZED(GTK_WIDGET(PWidget(wSelection)))) { + if (!sel.Empty() && wSelection.Created() && IS_WIDGET_REALIZED(GTK_WIDGET(PWidget(wSelection)))) { primarySelection = true; gtk_selection_owner_set(GTK_WIDGET(PWidget(wSelection)), GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME); -- cgit v1.2.3