diff --git a/include/wx/gtk/combobox.h b/include/wx/gtk/combobox.h index e31a347c8e..87aae8d9b9 100644 --- a/include/wx/gtk/combobox.h +++ b/include/wx/gtk/combobox.h @@ -56,6 +56,7 @@ public: Init(); Create(parent, id, value, pos, size, choices, style, validator, name); } + ~wxComboBox(); bool Create(wxWindow *parent, wxWindowID id, const wxString& value = wxEmptyString, diff --git a/include/wx/gtk/filectrl.h b/include/wx/gtk/filectrl.h index 0af8939ee7..4d11d7f59c 100644 --- a/include/wx/gtk/filectrl.h +++ b/include/wx/gtk/filectrl.h @@ -88,7 +88,7 @@ public: Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name ); } - virtual ~wxGtkFileCtrl() {} + virtual ~wxGtkFileCtrl(); bool Create( wxWindow *parent, wxWindowID id, diff --git a/include/wx/gtk/minifram.h b/include/wx/gtk/minifram.h index de339f016a..119ff2602a 100644 --- a/include/wx/gtk/minifram.h +++ b/include/wx/gtk/minifram.h @@ -33,6 +33,7 @@ public: { Create(parent, id, title, pos, size, style, name); } + ~wxMiniFrame(); bool Create(wxWindow *parent, wxWindowID id, diff --git a/include/wx/gtk/slider.h b/include/wx/gtk/slider.h index 50e9df086c..0476b55aae 100644 --- a/include/wx/gtk/slider.h +++ b/include/wx/gtk/slider.h @@ -30,6 +30,7 @@ public: Create( parent, id, value, minValue, maxValue, pos, size, style, validator, name ); } + ~wxSlider(); bool Create(wxWindow *parent, wxWindowID id, diff --git a/include/wx/gtk/webview_webkit.h b/include/wx/gtk/webview_webkit.h index 00ba41eb82..2246303c50 100644 --- a/include/wx/gtk/webview_webkit.h +++ b/include/wx/gtk/webview_webkit.h @@ -10,7 +10,7 @@ #ifndef _WX_GTK_WEBKITCTRL_H_ #define _WX_GTK_WEBKITCTRL_H_ -#include "wx/setup.h" +#include "wx/defs.h" #if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__) @@ -26,7 +26,7 @@ typedef struct _WebKitWebView WebKitWebView; class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView { public: - wxWebViewWebKit() { } + wxWebViewWebKit(); wxWebViewWebKit(wxWindow *parent, wxWindowID id = wxID_ANY, diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index 9a1efc1cc8..baeb7041fb 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -59,8 +59,6 @@ public: // implement base class (pure) virtual methods // ------------------------------------------- - virtual bool Destroy(); - virtual void Raise(); virtual void Lower(); @@ -308,7 +306,6 @@ public: // extra (wxGTK-specific) flags bool m_noExpose:1; // wxGLCanvas has its own redrawing bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size" - bool m_hasVMT:1; // set after PostCreation() is called bool m_isScrolling:1; // dragging scrollbar thumb? bool m_clipPaintRegion:1; // true after ScrollWindow() wxRegion m_nativeUpdateRegion; // not transformed for RTL @@ -352,6 +349,7 @@ protected: void GTKFreezeWidget(GtkWidget *w); void GTKThawWidget(GtkWidget *w); + void GTKDisconnect(void* instance); #if wxUSE_TOOLTIPS virtual void DoSetToolTip( wxToolTip *tip ); diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 3fb4de8aea..b19cacc6d3 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -30,8 +30,6 @@ extern bool g_blockEventsOnDrag; extern "C" { static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb) { - if (!cb->m_hasVMT) return; - if (g_blockEventsOnDrag) return; // Transitions for 3state checkbox must be done manually, GTK's checkbox diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index 32afd94246..dbc8579872 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -103,9 +103,6 @@ wxChoice::~wxChoice() void wxChoice::SendSelectionChangedEvent(wxEventType evt_type) { - if (!m_hasVMT) - return; - if (GetSelection() == -1) return; diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 35a5e0fec8..d29e2acb48 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -33,8 +33,6 @@ extern "C" { static void gtkcombobox_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo ) { - if (!combo->m_hasVMT) return; - wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() ); event.SetString( combo->GetValue() ); event.SetEventObject( combo ); @@ -87,6 +85,12 @@ BEGIN_EVENT_TABLE(wxComboBox, wxChoice) EVT_UPDATE_UI(wxID_SELECTALL, wxComboBox::OnUpdateSelectAll) END_EVENT_TABLE() +wxComboBox::~wxComboBox() +{ + if (m_entry) + GTKDisconnect(m_entry); +} + void wxComboBox::Init() { m_entry = NULL; diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp index 40c21e9e15..b03023f07e 100644 --- a/src/gtk/control.cpp +++ b/src/gtk/control.cpp @@ -139,9 +139,7 @@ void wxControl::GTKFixSensitivity(bool WXUNUSED_IN_GTK3(onlyIfUnderMouse)) #endif ) { - wxPoint pt = wxGetMousePosition(); - wxRect rect(ClientToScreen(wxPoint(0, 0)), GetSize()); - if (!onlyIfUnderMouse || rect.Contains(pt)) + if (!onlyIfUnderMouse || GetScreenRect().Contains(wxGetMousePosition())) { Hide(); Show(); diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index cf97ded419..26bc7cc8a7 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -4462,6 +4462,11 @@ wxDataViewCtrl::~wxDataViewCtrl() // This won't do anything if we're not editing it wxcol->GetRenderer()->CancelEditing(); } + + GTKDisconnect(m_treeview); + GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_treeview)); + if (selection) + GTKDisconnect(selection); } m_cols.Clear(); @@ -4471,6 +4476,7 @@ wxDataViewCtrl::~wxDataViewCtrl() void wxDataViewCtrl::Init() { + m_treeview = NULL; m_internal = NULL; m_cols.DeleteContents( true ); diff --git a/src/gtk/filectrl.cpp b/src/gtk/filectrl.cpp index 70cd51acbd..7eaf555117 100644 --- a/src/gtk/filectrl.cpp +++ b/src/gtk/filectrl.cpp @@ -285,6 +285,12 @@ extern "C" IMPLEMENT_DYNAMIC_CLASS( wxGtkFileCtrl, wxControl ) +wxGtkFileCtrl::~wxGtkFileCtrl() +{ + if (m_fcWidget) + GTKDisconnect(m_fcWidget); +} + void wxGtkFileCtrl::Init() { m_checkNextSelEvent = false; diff --git a/src/gtk/glcanvas.cpp b/src/gtk/glcanvas.cpp index 7ab78cc499..bdeb7d0cc6 100644 --- a/src/gtk/glcanvas.cpp +++ b/src/gtk/glcanvas.cpp @@ -99,9 +99,6 @@ gtk_glcanvas_size_callback(GtkWidget *WXUNUSED(widget), GtkAllocation * WXUNUSED(alloc), wxGLCanvas *win) { - if (!win->m_hasVMT) - return; - wxSizeEvent event( wxSize(win->m_width,win->m_height), win->GetId() ); event.SetEventObject( win ); win->HandleWindowEvent( event ); diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 788f1f4cb2..b3fcefba41 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -404,7 +404,13 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, wxListBox::~wxListBox() { - m_hasVMT = false; + if (m_treeview) + { + GTKDisconnect(m_treeview); + GtkTreeSelection* selection = gtk_tree_view_get_selection(m_treeview); + if (selection) + GTKDisconnect(selection); + } Clear(); } diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 8e2bc9647a..54856e2c7d 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -70,8 +70,7 @@ wxMenuBar::~wxMenuBar() GtkWidget* widget = m_widget; m_focusWidget = m_widget = NULL; - g_signal_handlers_disconnect_matched(widget, - GSignalMatchType(G_SIGNAL_MATCH_DATA), 0, 0, NULL, NULL, this); + GTKDisconnect(widget); g_object_unref(widget); } } @@ -750,7 +749,8 @@ wxMenu::~wxMenu() // Destroying a menu generates a "hide" signal even if it's not shown // currently, so disconnect it to avoid dummy wxEVT_MENU_CLOSE events // generation. - g_signal_handlers_disconnect_by_func(m_menu, (gpointer)menu_hide, this); + g_signal_handlers_disconnect_matched(m_menu, + GSignalMatchType(G_SIGNAL_MATCH_DATA), 0, 0, NULL, NULL, this); // see wxMenu::Init g_object_unref(m_menu); @@ -913,6 +913,10 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) return NULL; GtkWidget * const mitem = item->GetMenuItem(); + + g_signal_handlers_disconnect_matched(mitem, + GSignalMatchType(G_SIGNAL_MATCH_DATA), 0, 0, NULL, NULL, item); + #ifdef __WXGTK3__ gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL); #else diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp index bd3261e2b1..0cf5dd8d24 100644 --- a/src/gtk/minifram.cpp +++ b/src/gtk/minifram.cpp @@ -81,7 +81,7 @@ static gboolean expose_event(GtkWidget* widget, GdkEventExpose* gdk_event, wxMin wxGTKCairoDC dc(cr); #else - if (!win->m_hasVMT || gdk_event->count > 0 || + if (gdk_event->count > 0 || gdk_event->window != gtk_widget_get_window(widget)) { return false; @@ -144,7 +144,7 @@ extern "C" { static gboolean gtk_window_button_press_callback(GtkWidget* widget, GdkEventButton* gdk_event, wxMiniFrame* win) { - if (!win->m_hasVMT || gdk_event->window != gtk_widget_get_window(widget)) + if (gdk_event->window != gtk_widget_get_window(widget)) return false; if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnScroll) return TRUE; @@ -224,7 +224,7 @@ extern "C" { static gboolean gtk_window_button_release_callback(GtkWidget* widget, GdkEventButton* gdk_event, wxMiniFrame* win) { - if (!win->m_hasVMT || gdk_event->window != gtk_widget_get_window(widget)) + if (gdk_event->window != gtk_widget_get_window(widget)) return false; if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnScroll) return TRUE; @@ -257,9 +257,8 @@ extern "C" { static gboolean gtk_window_leave_callback(GtkWidget *widget, GdkEventCrossing* gdk_event, - wxMiniFrame *win) + wxMiniFrame*) { - if (!win->m_hasVMT) return FALSE; if (g_blockEventsOnDrag) return FALSE; if (gdk_event->window != gtk_widget_get_window(widget)) return false; @@ -278,7 +277,7 @@ extern "C" { static gboolean gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxMiniFrame *win ) { - if (!win->m_hasVMT || gdk_event->window != gtk_widget_get_window(widget)) + if (gdk_event->window != gtk_widget_get_window(widget)) return false; if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnScroll) return TRUE; @@ -340,6 +339,15 @@ static unsigned char close_bits[]={ IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame,wxFrame) +wxMiniFrame::~wxMiniFrame() +{ + if (m_widget) + { + GtkWidget* eventbox = gtk_bin_get_child(GTK_BIN(m_widget)); + GTKDisconnect(eventbox); + } +} + bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) diff --git a/src/gtk/msgdlg.cpp b/src/gtk/msgdlg.cpp index 906867c254..5bbdc930b8 100644 --- a/src/gtk/msgdlg.cpp +++ b/src/gtk/msgdlg.cpp @@ -292,6 +292,7 @@ int wxMessageDialog::ShowModal() gtk_window_present( GTK_WINDOW(m_parent->m_widget) ); gint result = gtk_dialog_run(GTK_DIALOG(m_widget)); + GTKDisconnect(m_widget); gtk_widget_destroy(m_widget); g_object_unref(m_widget); m_widget = NULL; diff --git a/src/gtk/nativewin.cpp b/src/gtk/nativewin.cpp index d95d98094d..91cb1ce613 100644 --- a/src/gtk/nativewin.cpp +++ b/src/gtk/nativewin.cpp @@ -125,6 +125,7 @@ void wxNativeContainerWindow::OnNativeDestroyed() // because it's a private GDK function and calling normal // gdk_window_destroy() results in X errors while nulling just the window // pointer and destroying m_widget results in many GTK errors + GTKDisconnect(m_widget); m_widget = NULL; // notice that we intentionally don't use Close() nor Delete() here as our diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 6cfbcad491..cc0b114c32 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -58,7 +58,6 @@ extern bool g_blockEventsOnDrag; extern "C" { static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBox *rb ) { - if (!rb->m_hasVMT) return; if (g_blockEventsOnDrag) return; if (!gtk_toggle_button_get_active(button)) return; @@ -78,7 +77,6 @@ static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBo extern "C" { static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxRadioBox *rb ) { - if (!rb->m_hasVMT) return FALSE; if (g_blockEventsOnDrag) return FALSE; if ( ((gdk_event->keyval == GDK_Tab) || @@ -319,6 +317,7 @@ wxRadioBox::~wxRadioBox() while (node) { GtkWidget *button = GTK_WIDGET( node->GetData()->button ); + GTKDisconnect(button); gtk_widget_destroy( button ); node = node->GetNext(); } diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index a0d1b92d2c..421d842575 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -32,8 +32,6 @@ extern "C" { static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *rb ) { - if (!rb->m_hasVMT) return; - if (g_blockEventsOnDrag) return; if (!gtk_toggle_button_get_active(button)) return; diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index 78f0d11808..c20ee70c5a 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -129,7 +129,7 @@ gtk_value_changed(GtkRange* range, wxSlider* win) const double oldPos = win->m_pos; win->m_pos = value; - if (!win->m_hasVMT || g_blockEventsOnDrag) + if (g_blockEventsOnDrag) return; if (win->GTKEventsDisabled()) @@ -275,10 +275,13 @@ static gchar* gtk_format_value(GtkScale*, double value, void*) wxSlider::wxSlider() { - m_pos = 0; - m_scrollEventType = GTK_SCROLL_NONE; - m_needThumbRelease = false; - m_blockScrollEvent = false; + m_scale = NULL; +} + +wxSlider::~wxSlider() +{ + if (m_scale && m_scale != m_widget) + GTKDisconnect(m_scale); } bool wxSlider::Create(wxWindow *parent, @@ -294,6 +297,8 @@ bool wxSlider::Create(wxWindow *parent, { m_pos = value; m_scrollEventType = GTK_SCROLL_NONE; + m_needThumbRelease = false; + m_blockScrollEvent = false; if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, validator, name )) diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index 52e8d4ce8f..5cb5b6bb89 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -38,7 +38,7 @@ gtk_value_changed(GtkSpinButton* spinbutton, wxSpinButton* win) const double value = gtk_spin_button_get_value(spinbutton); const int pos = int(value); const int oldPos = win->m_pos; - if (!win->m_hasVMT || g_blockEventsOnDrag || pos == oldPos) + if (g_blockEventsOnDrag || pos == oldPos) { win->m_pos = pos; return; diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index aed0313357..e7b798197a 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -39,7 +39,7 @@ extern "C" { static void gtk_value_changed(GtkSpinButton* spinbutton, wxSpinCtrlGTKBase* win) { - if (!win->m_hasVMT || g_blockEventsOnDrag) + if (g_blockEventsOnDrag) return; if (wxIsKindOf(win, wxSpinCtrl)) @@ -69,9 +69,6 @@ extern "C" { static void gtk_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win) { - if (!win->m_hasVMT) - return; - wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() ); event.SetEventObject( win ); event.SetString(gtk_entry_get_text(GTK_ENTRY(spinbutton))); diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 95f27a18fd..dda27477f3 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -546,8 +546,6 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) if ( win->IgnoreTextUpdate() ) return; - if (!win->m_hasVMT) return; - if ( win->MarkDirtyOnChange() ) win->MarkDirty(); @@ -607,12 +605,18 @@ void wxTextCtrl::Init() SetUpdateFont(false); m_text = NULL; + m_buffer = NULL; m_showPositionOnThaw = NULL; m_anonymousMarkList = NULL; } wxTextCtrl::~wxTextCtrl() { + if (m_text) + GTKDisconnect(m_text); + if (m_buffer) + GTKDisconnect(m_buffer); + // this is also done by wxWindowGTK dtor, but has to be done here so our // DoThaw() override is called while (IsFrozen()) diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp index 0589a9b70d..1ad831108f 100644 --- a/src/gtk/tglbtn.cpp +++ b/src/gtk/tglbtn.cpp @@ -29,7 +29,7 @@ extern bool g_blockEventsOnDrag; extern "C" { static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb) { - if (!cb->m_hasVMT || g_blockEventsOnDrag) + if (g_blockEventsOnDrag) return; // Generate a wx event. diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 99119fa896..4ca00b32be 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -269,7 +269,7 @@ gtk_frame_configure_callback( GtkWidget* widget, GdkEventConfigure *WXUNUSED(event), wxTopLevelWindowGTK *win ) { - if (!win->m_hasVMT || !win->IsShown()) + if (!win->IsShown()) return FALSE; wxPoint point; diff --git a/src/gtk/webview_webkit.cpp b/src/gtk/webview_webkit.cpp index 843b5a0164..28754d298a 100644 --- a/src/gtk/webview_webkit.cpp +++ b/src/gtk/webview_webkit.cpp @@ -33,11 +33,6 @@ wxgtk_webview_webkit_load_status(GtkWidget* widget, GParamSpec*, wxWebViewWebKit *webKitCtrl) { - // We can be called from webkit_web_view_dispose() during the window - // destruction, don't use half-destroyed object in this case. - if ( webKitCtrl->IsBeingDeleted() ) - return; - wxString url = webKitCtrl->GetCurrentURL(); WebKitLoadStatus status; @@ -391,6 +386,11 @@ wxgtk_webview_webkit_resource_req(WebKitWebView *, wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewWebKit, wxWebView); +wxWebViewWebKit::wxWebViewWebKit() +{ + m_web_view = NULL; +} + bool wxWebViewWebKit::Create(wxWindow *parent, wxWindowID id, const wxString &url, @@ -456,11 +456,8 @@ bool wxWebViewWebKit::Create(wxWindow *parent, wxWebViewWebKit::~wxWebViewWebKit() { - // The main goal here is to set m_isBeingDeleted to true to avoid the use - // of this -- already half-destroyed -- object from WebKit callbacks, but - // just setting it would prevent wxWindowDestroyEvent from being sent, so - // send it now instead. - SendDestroyEvent(); + if (m_web_view) + GTKDisconnect(m_web_view); } bool wxWebViewWebKit::Enable( bool enable ) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index d5352509f4..2542985379 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -950,8 +950,6 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gdk_event, wxWindow *win ) { - if (!win->m_hasVMT) - return FALSE; if (g_blockEventsOnDrag) return FALSE; @@ -1124,9 +1122,6 @@ gtk_window_key_release_callback( GtkWidget * WXUNUSED(widget), GdkEventKey *gdk_event, wxWindowGTK *win ) { - if (!win->m_hasVMT) - return FALSE; - if (g_blockEventsOnDrag) return FALSE; @@ -1276,13 +1271,11 @@ bool wxWindowGTK::GTKProcessEvent(wxEvent& event) const bool wxWindowGTK::GTKShouldIgnoreEvent() const { - return !m_hasVMT || g_blockEventsOnDrag; + return g_blockEventsOnDrag; } int wxWindowGTK::GTKCallbackCommonPrologue(GdkEventAny *event) const { - if (!m_hasVMT) - return FALSE; if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnScroll) @@ -2191,8 +2184,6 @@ void wxWindowGTK::Init() m_width = 0; m_height = 0; - m_hasVMT = false; - m_showOnIdle = false; m_noExpose = false; @@ -2359,6 +2350,12 @@ bool wxWindowGTK::Create( wxWindow *parent, return true; } +void wxWindowGTK::GTKDisconnect(void* instance) +{ + g_signal_handlers_disconnect_matched(instance, + GSignalMatchType(G_SIGNAL_MATCH_DATA), 0, 0, NULL, NULL, this); +} + wxWindowGTK::~wxWindowGTK() { SendDestroyEvent(); @@ -2371,23 +2368,14 @@ wxWindowGTK::~wxWindowGTK() if ( gs_deferredFocusOut == this ) gs_deferredFocusOut = NULL; - m_hasVMT = false; + if (m_widget) + GTKDisconnect(m_widget); + if (m_wxwindow && m_wxwindow != m_widget) + GTKDisconnect(m_wxwindow); // destroy children before destroying this window itself DestroyChildren(); - // unhook focus handlers to prevent stray events being - // propagated to this (soon to be) dead object - if (m_focusWidget != NULL) - { - g_signal_handlers_disconnect_by_func (m_focusWidget, - (gpointer) gtk_window_focus_in_callback, - this); - g_signal_handlers_disconnect_by_func (m_focusWidget, - (gpointer) gtk_window_focus_out_callback, - this); - } - if (m_widget) Show( false ); @@ -2564,8 +2552,6 @@ void wxWindowGTK::PostCreation() InheritAttributes(); - m_hasVMT = true; - SetLayoutDirection(wxLayout_Default); // unless the window was created initially hidden (i.e. Hide() had been @@ -2610,13 +2596,6 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget ) G_CALLBACK (gtk_window_leave_callback), this); } -bool wxWindowGTK::Destroy() -{ - m_hasVMT = false; - - return wxWindowBase::Destroy(); -} - static GSList* gs_queueResizeList; extern "C" { @@ -4571,7 +4550,7 @@ wxEventType wxWindowGTK::GTKGetScrollEventType(GtkRange* range) // update current position m_scrollPos[barIndex] = value; // If event should be ignored, or integral position has not changed - if (!m_hasVMT || g_blockEventsOnDrag || wxRound(value) == wxRound(oldPos)) + if (g_blockEventsOnDrag || wxRound(value) == wxRound(oldPos)) { return wxEVT_NULL; }