Work around Gtk3 Gtk-CRITICAL messages when closing some dialogs (#7)

There is a bug affecting Gtk+ 3.22.8 to 3.22.30 in which destroying a
GtkComboBox when it is not hidden results in this message:

    Gtk-CRITICAL **: gtk_widget_is_drawable: assertion 'GTK_IS_WIDGET (widget)' failed

This happens in GParted when some dialogs are closed, for example the
Create New Partition and Create Partition Table dialogs.  To work around
the issue we call Gtk::Dialog::hide() in the destructors of our dialog
classes.

The issue was fixed in Gtk 3.24.0.

 * Gtk 3.22.8 was released in February 2017.
 * Gtk 3.24.0 was released in September 2018.

References:

[1] Gtk Issue - GtkComboBox::private::popup_window can be NULL
    https://gitlab.gnome.org/GNOME/gtk/issues/125

[2] Gtk commit - combobox: popdown() the menu during unmap()
    7401794de6

[3] Gtk commit - Check for NULL priv->popup_window in
    gtk_combo_box_popdown()
    aa5d926c84

Closes #7 - Port to Gtk3
This commit is contained in:
Luca Bacci 2018-08-30 22:10:35 +02:00 committed by Mike Fleetwood
parent 392bbba534
commit 892f5542a4
4 changed files with 16 additions and 0 deletions

View File

@ -34,6 +34,7 @@ class Dialog_Disklabel : public Gtk::Dialog
{
public:
Dialog_Disklabel( const Device & device ) ;
~Dialog_Disklabel();
Glib::ustring Get_Disklabel( ) ;

View File

@ -392,6 +392,10 @@ Dialog_Base_Partition::~Dialog_Base_Partition()
size_change_connection .disconnect() ;
after_change_connection .disconnect() ;
delete frame_resizer_base;
// Work around a Gtk issue fixed in 3.24.0.
// https://gitlab.gnome.org/GNOME/gtk/issues/125
hide();
}
} //GParted

View File

@ -102,4 +102,11 @@ Glib::ustring Dialog_Disklabel::Get_Disklabel()
return labeltypes[ combo_labeltypes .get_active_row_number() ] ;
}
Dialog_Disklabel::~Dialog_Disklabel()
{
// Work around a Gtk issue fixed in 3.24.0.
// https://gitlab.gnome.org/GNOME/gtk/issues/125
hide();
}
}//GParted

View File

@ -45,6 +45,10 @@ Dialog_Partition_New::~Dialog_Partition_New()
{
delete new_partition;
new_partition = NULL;
// Work around a Gtk issue fixed in 3.24.0.
// https://gitlab.gnome.org/GNOME/gtk/issues/125
hide();
}
void Dialog_Partition_New::set_data( const Device & device,