Commit fa26cf48 authored by Debarshi Ray's avatar Debarshi Ray
Browse files

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 9bdf053a
parent de3a8fbd
......@@ -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 */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment