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



commit 892f5542a4ec3f278c1f75ab93d59a8987daf51a
Author: Luca Bacci <luca bacci982 gmail com>
Date:   Thu Aug 30 22:10:35 2018 +0200

    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()
        https://gitlab.gnome.org/GNOME/gtk/commit/7401794de6b084fea469af297b7c144724b8492c
    
    [3] Gtk commit - Check for NULL priv->popup_window in
        gtk_combo_box_popdown()
        https://gitlab.gnome.org/GNOME/gtk/commit/aa5d926c843aca2af576c38cf25ebdb4d3da2c26
    
    Closes #7 - Port to Gtk3

 include/Dialog_Disklabel.h   | 1 +
 src/Dialog_Base_Partition.cc | 4 ++++
 src/Dialog_Disklabel.cc      | 7 +++++++
 src/Dialog_Partition_New.cc  | 4 ++++
 4 files changed, 16 insertions(+)
---
diff --git a/include/Dialog_Disklabel.h b/include/Dialog_Disklabel.h
index c6a23496..c8781ace 100644
--- a/include/Dialog_Disklabel.h
+++ b/include/Dialog_Disklabel.h
@@ -34,6 +34,7 @@ class Dialog_Disklabel : public Gtk::Dialog
 {
 public:
        Dialog_Disklabel( const Device & device ) ;
+       ~Dialog_Disklabel();
 
        Glib::ustring Get_Disklabel( ) ;
        
diff --git a/src/Dialog_Base_Partition.cc b/src/Dialog_Base_Partition.cc
index fbbc5839..bfa278cb 100644
--- a/src/Dialog_Base_Partition.cc
+++ b/src/Dialog_Base_Partition.cc
@@ -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
diff --git a/src/Dialog_Disklabel.cc b/src/Dialog_Disklabel.cc
index 40874220..655d5bd6 100644
--- a/src/Dialog_Disklabel.cc
+++ b/src/Dialog_Disklabel.cc
@@ -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
diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc
index d6da6b03..83314b25 100644
--- a/src/Dialog_Partition_New.cc
+++ b/src/Dialog_Partition_New.cc
@@ -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,


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