Avoid using already-destroyed parts of wxChoice/wxComboBox during destruction
When used as a wxDVC cell editor, GtkComboBox has already destroyed it's model and child GtkEntry by the time our dtor is called. See #17034
This commit is contained in:
@@ -170,7 +170,8 @@ void wxChoice::DoClear()
|
|||||||
|
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
GtkTreeModel* model = gtk_combo_box_get_model( combobox );
|
GtkTreeModel* model = gtk_combo_box_get_model( combobox );
|
||||||
gtk_list_store_clear(GTK_LIST_STORE(model));
|
if (model)
|
||||||
|
gtk_list_store_clear(GTK_LIST_STORE(model));
|
||||||
|
|
||||||
m_clientData.Clear();
|
m_clientData.Clear();
|
||||||
|
|
||||||
|
@@ -99,7 +99,10 @@ wxEND_EVENT_TABLE()
|
|||||||
wxComboBox::~wxComboBox()
|
wxComboBox::~wxComboBox()
|
||||||
{
|
{
|
||||||
if (m_entry)
|
if (m_entry)
|
||||||
|
{
|
||||||
GTKDisconnect(m_entry);
|
GTKDisconnect(m_entry);
|
||||||
|
g_object_remove_weak_pointer(G_OBJECT(m_entry), (void**)&m_entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxComboBox::Init()
|
void wxComboBox::Init()
|
||||||
@@ -213,6 +216,7 @@ void wxComboBox::GTKCreateComboBoxWidget()
|
|||||||
g_object_ref(m_widget);
|
g_object_ref(m_widget);
|
||||||
|
|
||||||
m_entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(m_widget)));
|
m_entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(m_widget)));
|
||||||
|
g_object_add_weak_pointer(G_OBJECT(m_entry), (void**)&m_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkEditable *wxComboBox::GetEditable() const
|
GtkEditable *wxComboBox::GetEditable() const
|
||||||
|
Reference in New Issue
Block a user