diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index db2240b11e..c65967ab1a 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -170,7 +170,8 @@ void wxChoice::DoClear() GtkComboBox* combobox = GTK_COMBO_BOX( m_widget ); 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(); diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index e848edac65..4c0231dcf3 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -99,7 +99,10 @@ wxEND_EVENT_TABLE() wxComboBox::~wxComboBox() { if (m_entry) + { GTKDisconnect(m_entry); + g_object_remove_weak_pointer(G_OBJECT(m_entry), (void**)&m_entry); + } } void wxComboBox::Init() @@ -213,6 +216,7 @@ void wxComboBox::GTKCreateComboBoxWidget() g_object_ref(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