[gnome-photos] searchbar: Avoid CRITICALs when typing inside the preview



commit fa26cf4885dbbc69cd9c061b1b8f682ad228681d
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon May 15 17:01:55 2017 +0200

    searchbar: Avoid CRITICALs when typing inside the preview
    
    Typing while previewing an item that wasn't opened via a search led to:
      Gtk-CRITICAL **: gtk_widget_realize: assertion
        'widget->priv->anchored || GTK_IS_INVISIBLE (widget)' failed
      Gtk-CRITICAL **: gtk_widget_event: assertion
        'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
    
    This code is different from gnome-documents. It uses different
    MainToolbar sub-classes for each mode, while here the same MainToolbar
    instance is shared.
    
    The check to ensure that the Searchbar has a parent needs to be
    restored to avoid these CRITICALs.
    
    Fallout from 9bdf053a417c31e0be700c4c2716ddf95985bdf9
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776082

 src/photos-searchbar.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-searchbar.c b/src/photos-searchbar.c
index 8ed870c..054b145 100644
--- a/src/photos-searchbar.c
+++ b/src/photos-searchbar.c
@@ -236,6 +236,9 @@ photos_searchbar_handle_event (PhotosSearchbar *self, GdkEventKey *event)
 
   priv = photos_searchbar_get_instance_private (self);
 
+  if (gtk_widget_get_parent (GTK_WIDGET (self)) == NULL)
+    goto out;
+
   search_mode_enabled = gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (self));
 
   /* Skip if the search bar is shown and the focus is elsewhere */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]