Disconnect all GTK signals referencing a wx object which is being destructed
or which is destroying the associated GTK object git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72696 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -56,6 +56,7 @@ public:
|
|||||||
Init();
|
Init();
|
||||||
Create(parent, id, value, pos, size, choices, style, validator, name);
|
Create(parent, id, value, pos, size, choices, style, validator, name);
|
||||||
}
|
}
|
||||||
|
~wxComboBox();
|
||||||
|
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
bool Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxString& value = wxEmptyString,
|
const wxString& value = wxEmptyString,
|
||||||
|
@@ -88,7 +88,7 @@ public:
|
|||||||
Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name );
|
Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~wxGtkFileCtrl() {}
|
virtual ~wxGtkFileCtrl();
|
||||||
|
|
||||||
bool Create( wxWindow *parent,
|
bool Create( wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
|
@@ -33,6 +33,7 @@ public:
|
|||||||
{
|
{
|
||||||
Create(parent, id, title, pos, size, style, name);
|
Create(parent, id, title, pos, size, style, name);
|
||||||
}
|
}
|
||||||
|
~wxMiniFrame();
|
||||||
|
|
||||||
bool Create(wxWindow *parent,
|
bool Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
|
@@ -30,6 +30,7 @@ public:
|
|||||||
Create( parent, id, value, minValue, maxValue,
|
Create( parent, id, value, minValue, maxValue,
|
||||||
pos, size, style, validator, name );
|
pos, size, style, validator, name );
|
||||||
}
|
}
|
||||||
|
~wxSlider();
|
||||||
|
|
||||||
bool Create(wxWindow *parent,
|
bool Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#ifndef _WX_GTK_WEBKITCTRL_H_
|
#ifndef _WX_GTK_WEBKITCTRL_H_
|
||||||
#define _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__)
|
#if wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT && defined(__WXGTK__)
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ typedef struct _WebKitWebView WebKitWebView;
|
|||||||
class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView
|
class WXDLLIMPEXP_WEBVIEW wxWebViewWebKit : public wxWebView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxWebViewWebKit() { }
|
wxWebViewWebKit();
|
||||||
|
|
||||||
wxWebViewWebKit(wxWindow *parent,
|
wxWebViewWebKit(wxWindow *parent,
|
||||||
wxWindowID id = wxID_ANY,
|
wxWindowID id = wxID_ANY,
|
||||||
|
@@ -59,8 +59,6 @@ public:
|
|||||||
// implement base class (pure) virtual methods
|
// implement base class (pure) virtual methods
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
virtual bool Destroy();
|
|
||||||
|
|
||||||
virtual void Raise();
|
virtual void Raise();
|
||||||
virtual void Lower();
|
virtual void Lower();
|
||||||
|
|
||||||
@@ -308,7 +306,6 @@ public:
|
|||||||
// extra (wxGTK-specific) flags
|
// extra (wxGTK-specific) flags
|
||||||
bool m_noExpose:1; // wxGLCanvas has its own redrawing
|
bool m_noExpose:1; // wxGLCanvas has its own redrawing
|
||||||
bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size"
|
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_isScrolling:1; // dragging scrollbar thumb?
|
||||||
bool m_clipPaintRegion:1; // true after ScrollWindow()
|
bool m_clipPaintRegion:1; // true after ScrollWindow()
|
||||||
wxRegion m_nativeUpdateRegion; // not transformed for RTL
|
wxRegion m_nativeUpdateRegion; // not transformed for RTL
|
||||||
@@ -352,6 +349,7 @@ protected:
|
|||||||
|
|
||||||
void GTKFreezeWidget(GtkWidget *w);
|
void GTKFreezeWidget(GtkWidget *w);
|
||||||
void GTKThawWidget(GtkWidget *w);
|
void GTKThawWidget(GtkWidget *w);
|
||||||
|
void GTKDisconnect(void* instance);
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
virtual void DoSetToolTip( wxToolTip *tip );
|
virtual void DoSetToolTip( wxToolTip *tip );
|
||||||
|
@@ -30,8 +30,6 @@ extern bool g_blockEventsOnDrag;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb)
|
static void gtk_checkbox_toggled_callback(GtkWidget *widget, wxCheckBox *cb)
|
||||||
{
|
{
|
||||||
if (!cb->m_hasVMT) return;
|
|
||||||
|
|
||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
// Transitions for 3state checkbox must be done manually, GTK's checkbox
|
// Transitions for 3state checkbox must be done manually, GTK's checkbox
|
||||||
|
@@ -103,9 +103,6 @@ wxChoice::~wxChoice()
|
|||||||
|
|
||||||
void wxChoice::SendSelectionChangedEvent(wxEventType evt_type)
|
void wxChoice::SendSelectionChangedEvent(wxEventType evt_type)
|
||||||
{
|
{
|
||||||
if (!m_hasVMT)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (GetSelection() == -1)
|
if (GetSelection() == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -33,8 +33,6 @@ extern "C" {
|
|||||||
static void
|
static void
|
||||||
gtkcombobox_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
gtkcombobox_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||||
{
|
{
|
||||||
if (!combo->m_hasVMT) return;
|
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
|
||||||
event.SetString( combo->GetValue() );
|
event.SetString( combo->GetValue() );
|
||||||
event.SetEventObject( combo );
|
event.SetEventObject( combo );
|
||||||
@@ -87,6 +85,12 @@ BEGIN_EVENT_TABLE(wxComboBox, wxChoice)
|
|||||||
EVT_UPDATE_UI(wxID_SELECTALL, wxComboBox::OnUpdateSelectAll)
|
EVT_UPDATE_UI(wxID_SELECTALL, wxComboBox::OnUpdateSelectAll)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
wxComboBox::~wxComboBox()
|
||||||
|
{
|
||||||
|
if (m_entry)
|
||||||
|
GTKDisconnect(m_entry);
|
||||||
|
}
|
||||||
|
|
||||||
void wxComboBox::Init()
|
void wxComboBox::Init()
|
||||||
{
|
{
|
||||||
m_entry = NULL;
|
m_entry = NULL;
|
||||||
|
@@ -139,9 +139,7 @@ void wxControl::GTKFixSensitivity(bool WXUNUSED_IN_GTK3(onlyIfUnderMouse))
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
wxPoint pt = wxGetMousePosition();
|
if (!onlyIfUnderMouse || GetScreenRect().Contains(wxGetMousePosition()))
|
||||||
wxRect rect(ClientToScreen(wxPoint(0, 0)), GetSize());
|
|
||||||
if (!onlyIfUnderMouse || rect.Contains(pt))
|
|
||||||
{
|
{
|
||||||
Hide();
|
Hide();
|
||||||
Show();
|
Show();
|
||||||
|
@@ -4462,6 +4462,11 @@ wxDataViewCtrl::~wxDataViewCtrl()
|
|||||||
// This won't do anything if we're not editing it
|
// This won't do anything if we're not editing it
|
||||||
wxcol->GetRenderer()->CancelEditing();
|
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();
|
m_cols.Clear();
|
||||||
@@ -4471,6 +4476,7 @@ wxDataViewCtrl::~wxDataViewCtrl()
|
|||||||
|
|
||||||
void wxDataViewCtrl::Init()
|
void wxDataViewCtrl::Init()
|
||||||
{
|
{
|
||||||
|
m_treeview = NULL;
|
||||||
m_internal = NULL;
|
m_internal = NULL;
|
||||||
|
|
||||||
m_cols.DeleteContents( true );
|
m_cols.DeleteContents( true );
|
||||||
|
@@ -285,6 +285,12 @@ extern "C"
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS( wxGtkFileCtrl, wxControl )
|
IMPLEMENT_DYNAMIC_CLASS( wxGtkFileCtrl, wxControl )
|
||||||
|
|
||||||
|
wxGtkFileCtrl::~wxGtkFileCtrl()
|
||||||
|
{
|
||||||
|
if (m_fcWidget)
|
||||||
|
GTKDisconnect(m_fcWidget);
|
||||||
|
}
|
||||||
|
|
||||||
void wxGtkFileCtrl::Init()
|
void wxGtkFileCtrl::Init()
|
||||||
{
|
{
|
||||||
m_checkNextSelEvent = false;
|
m_checkNextSelEvent = false;
|
||||||
|
@@ -99,9 +99,6 @@ gtk_glcanvas_size_callback(GtkWidget *WXUNUSED(widget),
|
|||||||
GtkAllocation * WXUNUSED(alloc),
|
GtkAllocation * WXUNUSED(alloc),
|
||||||
wxGLCanvas *win)
|
wxGLCanvas *win)
|
||||||
{
|
{
|
||||||
if (!win->m_hasVMT)
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxSizeEvent event( wxSize(win->m_width,win->m_height), win->GetId() );
|
wxSizeEvent event( wxSize(win->m_width,win->m_height), win->GetId() );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
win->HandleWindowEvent( event );
|
win->HandleWindowEvent( event );
|
||||||
|
@@ -404,7 +404,13 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
wxListBox::~wxListBox()
|
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();
|
Clear();
|
||||||
}
|
}
|
||||||
|
@@ -70,8 +70,7 @@ wxMenuBar::~wxMenuBar()
|
|||||||
GtkWidget* widget = m_widget;
|
GtkWidget* widget = m_widget;
|
||||||
m_focusWidget =
|
m_focusWidget =
|
||||||
m_widget = NULL;
|
m_widget = NULL;
|
||||||
g_signal_handlers_disconnect_matched(widget,
|
GTKDisconnect(widget);
|
||||||
GSignalMatchType(G_SIGNAL_MATCH_DATA), 0, 0, NULL, NULL, this);
|
|
||||||
g_object_unref(widget);
|
g_object_unref(widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -750,7 +749,8 @@ wxMenu::~wxMenu()
|
|||||||
// Destroying a menu generates a "hide" signal even if it's not shown
|
// Destroying a menu generates a "hide" signal even if it's not shown
|
||||||
// currently, so disconnect it to avoid dummy wxEVT_MENU_CLOSE events
|
// currently, so disconnect it to avoid dummy wxEVT_MENU_CLOSE events
|
||||||
// generation.
|
// 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
|
// see wxMenu::Init
|
||||||
g_object_unref(m_menu);
|
g_object_unref(m_menu);
|
||||||
@@ -913,6 +913,10 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
GtkWidget * const mitem = item->GetMenuItem();
|
GtkWidget * const mitem = item->GetMenuItem();
|
||||||
|
|
||||||
|
g_signal_handlers_disconnect_matched(mitem,
|
||||||
|
GSignalMatchType(G_SIGNAL_MATCH_DATA), 0, 0, NULL, NULL, item);
|
||||||
|
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL);
|
gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL);
|
||||||
#else
|
#else
|
||||||
|
@@ -81,7 +81,7 @@ static gboolean expose_event(GtkWidget* widget, GdkEventExpose* gdk_event, wxMin
|
|||||||
|
|
||||||
wxGTKCairoDC dc(cr);
|
wxGTKCairoDC dc(cr);
|
||||||
#else
|
#else
|
||||||
if (!win->m_hasVMT || gdk_event->count > 0 ||
|
if (gdk_event->count > 0 ||
|
||||||
gdk_event->window != gtk_widget_get_window(widget))
|
gdk_event->window != gtk_widget_get_window(widget))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -144,7 +144,7 @@ extern "C" {
|
|||||||
static gboolean
|
static gboolean
|
||||||
gtk_window_button_press_callback(GtkWidget* widget, GdkEventButton* gdk_event, wxMiniFrame* win)
|
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;
|
return false;
|
||||||
if (g_blockEventsOnDrag) return TRUE;
|
if (g_blockEventsOnDrag) return TRUE;
|
||||||
if (g_blockEventsOnScroll) return TRUE;
|
if (g_blockEventsOnScroll) return TRUE;
|
||||||
@@ -224,7 +224,7 @@ extern "C" {
|
|||||||
static gboolean
|
static gboolean
|
||||||
gtk_window_button_release_callback(GtkWidget* widget, GdkEventButton* gdk_event, wxMiniFrame* win)
|
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;
|
return false;
|
||||||
if (g_blockEventsOnDrag) return TRUE;
|
if (g_blockEventsOnDrag) return TRUE;
|
||||||
if (g_blockEventsOnScroll) return TRUE;
|
if (g_blockEventsOnScroll) return TRUE;
|
||||||
@@ -257,9 +257,8 @@ extern "C" {
|
|||||||
static gboolean
|
static gboolean
|
||||||
gtk_window_leave_callback(GtkWidget *widget,
|
gtk_window_leave_callback(GtkWidget *widget,
|
||||||
GdkEventCrossing* gdk_event,
|
GdkEventCrossing* gdk_event,
|
||||||
wxMiniFrame *win)
|
wxMiniFrame*)
|
||||||
{
|
{
|
||||||
if (!win->m_hasVMT) return FALSE;
|
|
||||||
if (g_blockEventsOnDrag) return FALSE;
|
if (g_blockEventsOnDrag) return FALSE;
|
||||||
if (gdk_event->window != gtk_widget_get_window(widget))
|
if (gdk_event->window != gtk_widget_get_window(widget))
|
||||||
return false;
|
return false;
|
||||||
@@ -278,7 +277,7 @@ extern "C" {
|
|||||||
static gboolean
|
static gboolean
|
||||||
gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxMiniFrame *win )
|
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;
|
return false;
|
||||||
if (g_blockEventsOnDrag) return TRUE;
|
if (g_blockEventsOnDrag) return TRUE;
|
||||||
if (g_blockEventsOnScroll) return TRUE;
|
if (g_blockEventsOnScroll) return TRUE;
|
||||||
@@ -340,6 +339,15 @@ static unsigned char close_bits[]={
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame,wxFrame)
|
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,
|
bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
long style, const wxString &name )
|
long style, const wxString &name )
|
||||||
|
@@ -292,6 +292,7 @@ int wxMessageDialog::ShowModal()
|
|||||||
gtk_window_present( GTK_WINDOW(m_parent->m_widget) );
|
gtk_window_present( GTK_WINDOW(m_parent->m_widget) );
|
||||||
|
|
||||||
gint result = gtk_dialog_run(GTK_DIALOG(m_widget));
|
gint result = gtk_dialog_run(GTK_DIALOG(m_widget));
|
||||||
|
GTKDisconnect(m_widget);
|
||||||
gtk_widget_destroy(m_widget);
|
gtk_widget_destroy(m_widget);
|
||||||
g_object_unref(m_widget);
|
g_object_unref(m_widget);
|
||||||
m_widget = NULL;
|
m_widget = NULL;
|
||||||
|
@@ -125,6 +125,7 @@ void wxNativeContainerWindow::OnNativeDestroyed()
|
|||||||
// because it's a private GDK function and calling normal
|
// because it's a private GDK function and calling normal
|
||||||
// gdk_window_destroy() results in X errors while nulling just the window
|
// gdk_window_destroy() results in X errors while nulling just the window
|
||||||
// pointer and destroying m_widget results in many GTK errors
|
// pointer and destroying m_widget results in many GTK errors
|
||||||
|
GTKDisconnect(m_widget);
|
||||||
m_widget = NULL;
|
m_widget = NULL;
|
||||||
|
|
||||||
// notice that we intentionally don't use Close() nor Delete() here as our
|
// notice that we intentionally don't use Close() nor Delete() here as our
|
||||||
|
@@ -58,7 +58,6 @@ extern bool g_blockEventsOnDrag;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBox *rb )
|
static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBox *rb )
|
||||||
{
|
{
|
||||||
if (!rb->m_hasVMT) return;
|
|
||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
if (!gtk_toggle_button_get_active(button)) return;
|
if (!gtk_toggle_button_get_active(button)) return;
|
||||||
@@ -78,7 +77,6 @@ static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBo
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
static gint gtk_radiobox_keypress_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxRadioBox *rb )
|
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 (g_blockEventsOnDrag) return FALSE;
|
||||||
|
|
||||||
if ( ((gdk_event->keyval == GDK_Tab) ||
|
if ( ((gdk_event->keyval == GDK_Tab) ||
|
||||||
@@ -319,6 +317,7 @@ wxRadioBox::~wxRadioBox()
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
GtkWidget *button = GTK_WIDGET( node->GetData()->button );
|
GtkWidget *button = GTK_WIDGET( node->GetData()->button );
|
||||||
|
GTKDisconnect(button);
|
||||||
gtk_widget_destroy( button );
|
gtk_widget_destroy( button );
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
|
@@ -32,8 +32,6 @@ extern "C" {
|
|||||||
static
|
static
|
||||||
void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *rb )
|
void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *rb )
|
||||||
{
|
{
|
||||||
if (!rb->m_hasVMT) return;
|
|
||||||
|
|
||||||
if (g_blockEventsOnDrag) return;
|
if (g_blockEventsOnDrag) return;
|
||||||
|
|
||||||
if (!gtk_toggle_button_get_active(button)) return;
|
if (!gtk_toggle_button_get_active(button)) return;
|
||||||
|
@@ -129,7 +129,7 @@ gtk_value_changed(GtkRange* range, wxSlider* win)
|
|||||||
const double oldPos = win->m_pos;
|
const double oldPos = win->m_pos;
|
||||||
win->m_pos = value;
|
win->m_pos = value;
|
||||||
|
|
||||||
if (!win->m_hasVMT || g_blockEventsOnDrag)
|
if (g_blockEventsOnDrag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (win->GTKEventsDisabled())
|
if (win->GTKEventsDisabled())
|
||||||
@@ -275,10 +275,13 @@ static gchar* gtk_format_value(GtkScale*, double value, void*)
|
|||||||
|
|
||||||
wxSlider::wxSlider()
|
wxSlider::wxSlider()
|
||||||
{
|
{
|
||||||
m_pos = 0;
|
m_scale = NULL;
|
||||||
m_scrollEventType = GTK_SCROLL_NONE;
|
}
|
||||||
m_needThumbRelease = false;
|
|
||||||
m_blockScrollEvent = false;
|
wxSlider::~wxSlider()
|
||||||
|
{
|
||||||
|
if (m_scale && m_scale != m_widget)
|
||||||
|
GTKDisconnect(m_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSlider::Create(wxWindow *parent,
|
bool wxSlider::Create(wxWindow *parent,
|
||||||
@@ -294,6 +297,8 @@ bool wxSlider::Create(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
m_pos = value;
|
m_pos = value;
|
||||||
m_scrollEventType = GTK_SCROLL_NONE;
|
m_scrollEventType = GTK_SCROLL_NONE;
|
||||||
|
m_needThumbRelease = false;
|
||||||
|
m_blockScrollEvent = false;
|
||||||
|
|
||||||
if (!PreCreation( parent, pos, size ) ||
|
if (!PreCreation( parent, pos, size ) ||
|
||||||
!CreateBase( parent, id, pos, size, style, validator, name ))
|
!CreateBase( parent, id, pos, size, style, validator, name ))
|
||||||
|
@@ -38,7 +38,7 @@ gtk_value_changed(GtkSpinButton* spinbutton, wxSpinButton* win)
|
|||||||
const double value = gtk_spin_button_get_value(spinbutton);
|
const double value = gtk_spin_button_get_value(spinbutton);
|
||||||
const int pos = int(value);
|
const int pos = int(value);
|
||||||
const int oldPos = win->m_pos;
|
const int oldPos = win->m_pos;
|
||||||
if (!win->m_hasVMT || g_blockEventsOnDrag || pos == oldPos)
|
if (g_blockEventsOnDrag || pos == oldPos)
|
||||||
{
|
{
|
||||||
win->m_pos = pos;
|
win->m_pos = pos;
|
||||||
return;
|
return;
|
||||||
|
@@ -39,7 +39,7 @@ extern "C" {
|
|||||||
static void
|
static void
|
||||||
gtk_value_changed(GtkSpinButton* spinbutton, wxSpinCtrlGTKBase* win)
|
gtk_value_changed(GtkSpinButton* spinbutton, wxSpinCtrlGTKBase* win)
|
||||||
{
|
{
|
||||||
if (!win->m_hasVMT || g_blockEventsOnDrag)
|
if (g_blockEventsOnDrag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (wxIsKindOf(win, wxSpinCtrl))
|
if (wxIsKindOf(win, wxSpinCtrl))
|
||||||
@@ -69,9 +69,6 @@ extern "C" {
|
|||||||
static void
|
static void
|
||||||
gtk_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win)
|
gtk_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win)
|
||||||
{
|
{
|
||||||
if (!win->m_hasVMT)
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
event.SetString(gtk_entry_get_text(GTK_ENTRY(spinbutton)));
|
event.SetString(gtk_entry_get_text(GTK_ENTRY(spinbutton)));
|
||||||
|
@@ -546,8 +546,6 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
|
|||||||
if ( win->IgnoreTextUpdate() )
|
if ( win->IgnoreTextUpdate() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!win->m_hasVMT) return;
|
|
||||||
|
|
||||||
if ( win->MarkDirtyOnChange() )
|
if ( win->MarkDirtyOnChange() )
|
||||||
win->MarkDirty();
|
win->MarkDirty();
|
||||||
|
|
||||||
@@ -607,12 +605,18 @@ void wxTextCtrl::Init()
|
|||||||
SetUpdateFont(false);
|
SetUpdateFont(false);
|
||||||
|
|
||||||
m_text = NULL;
|
m_text = NULL;
|
||||||
|
m_buffer = NULL;
|
||||||
m_showPositionOnThaw = NULL;
|
m_showPositionOnThaw = NULL;
|
||||||
m_anonymousMarkList = NULL;
|
m_anonymousMarkList = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextCtrl::~wxTextCtrl()
|
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
|
// this is also done by wxWindowGTK dtor, but has to be done here so our
|
||||||
// DoThaw() override is called
|
// DoThaw() override is called
|
||||||
while (IsFrozen())
|
while (IsFrozen())
|
||||||
|
@@ -29,7 +29,7 @@ extern bool g_blockEventsOnDrag;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb)
|
static void gtk_togglebutton_clicked_callback(GtkWidget *WXUNUSED(widget), wxToggleButton *cb)
|
||||||
{
|
{
|
||||||
if (!cb->m_hasVMT || g_blockEventsOnDrag)
|
if (g_blockEventsOnDrag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Generate a wx event.
|
// Generate a wx event.
|
||||||
|
@@ -269,7 +269,7 @@ gtk_frame_configure_callback( GtkWidget* widget,
|
|||||||
GdkEventConfigure *WXUNUSED(event),
|
GdkEventConfigure *WXUNUSED(event),
|
||||||
wxTopLevelWindowGTK *win )
|
wxTopLevelWindowGTK *win )
|
||||||
{
|
{
|
||||||
if (!win->m_hasVMT || !win->IsShown())
|
if (!win->IsShown())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
wxPoint point;
|
wxPoint point;
|
||||||
|
@@ -33,11 +33,6 @@ wxgtk_webview_webkit_load_status(GtkWidget* widget,
|
|||||||
GParamSpec*,
|
GParamSpec*,
|
||||||
wxWebViewWebKit *webKitCtrl)
|
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();
|
wxString url = webKitCtrl->GetCurrentURL();
|
||||||
|
|
||||||
WebKitLoadStatus status;
|
WebKitLoadStatus status;
|
||||||
@@ -391,6 +386,11 @@ wxgtk_webview_webkit_resource_req(WebKitWebView *,
|
|||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewWebKit, wxWebView);
|
wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewWebKit, wxWebView);
|
||||||
|
|
||||||
|
wxWebViewWebKit::wxWebViewWebKit()
|
||||||
|
{
|
||||||
|
m_web_view = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxWebViewWebKit::Create(wxWindow *parent,
|
bool wxWebViewWebKit::Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString &url,
|
const wxString &url,
|
||||||
@@ -456,11 +456,8 @@ bool wxWebViewWebKit::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxWebViewWebKit::~wxWebViewWebKit()
|
wxWebViewWebKit::~wxWebViewWebKit()
|
||||||
{
|
{
|
||||||
// The main goal here is to set m_isBeingDeleted to true to avoid the use
|
if (m_web_view)
|
||||||
// of this -- already half-destroyed -- object from WebKit callbacks, but
|
GTKDisconnect(m_web_view);
|
||||||
// just setting it would prevent wxWindowDestroyEvent from being sent, so
|
|
||||||
// send it now instead.
|
|
||||||
SendDestroyEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWebViewWebKit::Enable( bool enable )
|
bool wxWebViewWebKit::Enable( bool enable )
|
||||||
|
@@ -950,8 +950,6 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget),
|
|||||||
GdkEventKey *gdk_event,
|
GdkEventKey *gdk_event,
|
||||||
wxWindow *win )
|
wxWindow *win )
|
||||||
{
|
{
|
||||||
if (!win->m_hasVMT)
|
|
||||||
return FALSE;
|
|
||||||
if (g_blockEventsOnDrag)
|
if (g_blockEventsOnDrag)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@@ -1124,9 +1122,6 @@ gtk_window_key_release_callback( GtkWidget * WXUNUSED(widget),
|
|||||||
GdkEventKey *gdk_event,
|
GdkEventKey *gdk_event,
|
||||||
wxWindowGTK *win )
|
wxWindowGTK *win )
|
||||||
{
|
{
|
||||||
if (!win->m_hasVMT)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (g_blockEventsOnDrag)
|
if (g_blockEventsOnDrag)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@@ -1276,13 +1271,11 @@ bool wxWindowGTK::GTKProcessEvent(wxEvent& event) const
|
|||||||
|
|
||||||
bool wxWindowGTK::GTKShouldIgnoreEvent() const
|
bool wxWindowGTK::GTKShouldIgnoreEvent() const
|
||||||
{
|
{
|
||||||
return !m_hasVMT || g_blockEventsOnDrag;
|
return g_blockEventsOnDrag;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxWindowGTK::GTKCallbackCommonPrologue(GdkEventAny *event) const
|
int wxWindowGTK::GTKCallbackCommonPrologue(GdkEventAny *event) const
|
||||||
{
|
{
|
||||||
if (!m_hasVMT)
|
|
||||||
return FALSE;
|
|
||||||
if (g_blockEventsOnDrag)
|
if (g_blockEventsOnDrag)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (g_blockEventsOnScroll)
|
if (g_blockEventsOnScroll)
|
||||||
@@ -2191,8 +2184,6 @@ void wxWindowGTK::Init()
|
|||||||
m_width = 0;
|
m_width = 0;
|
||||||
m_height = 0;
|
m_height = 0;
|
||||||
|
|
||||||
m_hasVMT = false;
|
|
||||||
|
|
||||||
m_showOnIdle = false;
|
m_showOnIdle = false;
|
||||||
|
|
||||||
m_noExpose = false;
|
m_noExpose = false;
|
||||||
@@ -2359,6 +2350,12 @@ bool wxWindowGTK::Create( wxWindow *parent,
|
|||||||
return true;
|
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()
|
wxWindowGTK::~wxWindowGTK()
|
||||||
{
|
{
|
||||||
SendDestroyEvent();
|
SendDestroyEvent();
|
||||||
@@ -2371,23 +2368,14 @@ wxWindowGTK::~wxWindowGTK()
|
|||||||
if ( gs_deferredFocusOut == this )
|
if ( gs_deferredFocusOut == this )
|
||||||
gs_deferredFocusOut = NULL;
|
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
|
// destroy children before destroying this window itself
|
||||||
DestroyChildren();
|
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)
|
if (m_widget)
|
||||||
Show( false );
|
Show( false );
|
||||||
|
|
||||||
@@ -2564,8 +2552,6 @@ void wxWindowGTK::PostCreation()
|
|||||||
|
|
||||||
InheritAttributes();
|
InheritAttributes();
|
||||||
|
|
||||||
m_hasVMT = true;
|
|
||||||
|
|
||||||
SetLayoutDirection(wxLayout_Default);
|
SetLayoutDirection(wxLayout_Default);
|
||||||
|
|
||||||
// unless the window was created initially hidden (i.e. Hide() had been
|
// 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);
|
G_CALLBACK (gtk_window_leave_callback), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowGTK::Destroy()
|
|
||||||
{
|
|
||||||
m_hasVMT = false;
|
|
||||||
|
|
||||||
return wxWindowBase::Destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
static GSList* gs_queueResizeList;
|
static GSList* gs_queueResizeList;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -4571,7 +4550,7 @@ wxEventType wxWindowGTK::GTKGetScrollEventType(GtkRange* range)
|
|||||||
// update current position
|
// update current position
|
||||||
m_scrollPos[barIndex] = value;
|
m_scrollPos[barIndex] = value;
|
||||||
// If event should be ignored, or integral position has not changed
|
// 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;
|
return wxEVT_NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user