Generate wxEVT_SPINCTRL of the correct wxSpinEvent type.
Handlers for this event expect to get wxSpinEvent but wxMSW, wxGTK1 and wxQT sent an object of base wxCommandEvent class which resulted in invalid memory access in the handlers when using the derived class methods such as Veto(). Closes #16948.
This commit is contained in:
@@ -179,8 +179,6 @@ wxDEFINE_EVENT( wxEVT_VLBOX, wxCommandEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMBOBOX, wxCommandEvent );
|
||||
wxDEFINE_EVENT( wxEVT_TOOL_RCLICKED, wxCommandEvent );
|
||||
wxDEFINE_EVENT( wxEVT_TOOL_ENTER, wxCommandEvent );
|
||||
wxDEFINE_EVENT( wxEVT_SPINCTRL, wxCommandEvent );
|
||||
wxDEFINE_EVENT( wxEVT_SPINCTRLDOUBLE, wxCommandEvent );
|
||||
wxDEFINE_EVENT( wxEVT_TOOL_DROPDOWN, wxCommandEvent );
|
||||
wxDEFINE_EVENT( wxEVT_COMBOBOX_DROPDOWN, wxCommandEvent);
|
||||
wxDEFINE_EVENT( wxEVT_COMBOBOX_CLOSEUP, wxCommandEvent);
|
||||
|
@@ -82,7 +82,7 @@ static void gtk_spinctrl_callback( GtkWidget *WXUNUSED(widget), wxSpinCtrl *win
|
||||
if (!win->m_hasVMT) return;
|
||||
if (g_blockEventsOnDrag) return;
|
||||
|
||||
wxCommandEvent event( wxEVT_SPINCTRL, win->GetId());
|
||||
wxSpinEvent event( wxEVT_SPINCTRL, win->GetId());
|
||||
event.SetEventObject( win );
|
||||
|
||||
// note that we don't use wxSpinCtrl::GetValue() here because it would
|
||||
|
@@ -684,7 +684,7 @@ void wxSpinCtrl::DoSetToolTip(wxToolTip *tip)
|
||||
|
||||
void wxSpinCtrl::SendSpinUpdate(int value)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_SPINCTRL, GetId());
|
||||
wxSpinEvent event(wxEVT_SPINCTRL, GetId());
|
||||
event.SetEventObject(this);
|
||||
event.SetInt(value);
|
||||
|
||||
|
@@ -217,7 +217,7 @@ void wxQtSpinBox::valueChanged(int value)
|
||||
wxControl *handler = GetHandler();
|
||||
if ( handler )
|
||||
{
|
||||
wxCommandEvent event( wxEVT_SPINCTRL, handler->GetId() );
|
||||
wxSpinEvent event( wxEVT_SPINCTRL, handler->GetId() );
|
||||
event.SetInt( value );
|
||||
EmitEvent( event );
|
||||
}
|
||||
|
Reference in New Issue
Block a user