Correct wxWindowQt::DoSetSize() for possible NULL member de-reference.
Thanks David Register git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -422,7 +422,7 @@ void wxWindowQt::Refresh( bool WXUNUSED( eraseBackground ), const wxRect *rect )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool wxWindowQt::SetFont( const wxFont &font )
|
bool wxWindowQt::SetFont( const wxFont &font )
|
||||||
{
|
{
|
||||||
// SetFont may be called before Create, so the font is stored
|
// SetFont may be called before Create, so the font is stored
|
||||||
@@ -544,7 +544,7 @@ void wxWindowQt::SetScrollbar( int orientation, int pos, int thumbvisible, int r
|
|||||||
scrollBar->GetHandle()->setEnabled( false );
|
scrollBar->GetHandle()->setEnabled( false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
scrollBar->GetHandle()->setEnabled( true );
|
scrollBar->GetHandle()->setEnabled( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,7 +560,7 @@ int wxWindowQt::GetScrollPos( int orientation ) const
|
|||||||
{
|
{
|
||||||
wxScrollBar *scrollBar = QtGetScrollBar( orientation );
|
wxScrollBar *scrollBar = QtGetScrollBar( orientation );
|
||||||
wxCHECK_MSG( scrollBar, 0, "Invalid scrollbar" );
|
wxCHECK_MSG( scrollBar, 0, "Invalid scrollbar" );
|
||||||
|
|
||||||
return scrollBar->GetThumbPosition();
|
return scrollBar->GetThumbPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,7 +568,7 @@ int wxWindowQt::GetScrollThumb( int orientation ) const
|
|||||||
{
|
{
|
||||||
wxScrollBar *scrollBar = QtGetScrollBar( orientation );
|
wxScrollBar *scrollBar = QtGetScrollBar( orientation );
|
||||||
wxCHECK_MSG( scrollBar, 0, "Invalid scrollbar" );
|
wxCHECK_MSG( scrollBar, 0, "Invalid scrollbar" );
|
||||||
|
|
||||||
return scrollBar->GetThumbSize();
|
return scrollBar->GetThumbSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,7 +576,7 @@ int wxWindowQt::GetScrollRange( int orientation ) const
|
|||||||
{
|
{
|
||||||
wxScrollBar *scrollBar = QtGetScrollBar( orientation );
|
wxScrollBar *scrollBar = QtGetScrollBar( orientation );
|
||||||
wxCHECK_MSG( scrollBar, 0, "Invalid scrollbar" );
|
wxCHECK_MSG( scrollBar, 0, "Invalid scrollbar" );
|
||||||
|
|
||||||
return scrollBar->GetRange();
|
return scrollBar->GetRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,7 +627,7 @@ void wxWindowQt::ScrollWindow( int dx, int dy, const wxRect *rect )
|
|||||||
else
|
else
|
||||||
widget->scroll( dx, dy );
|
widget->scroll( dx, dy );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxWindowQt::SetDropTarget( wxDropTarget * WXUNUSED( dropTarget ) )
|
void wxWindowQt::SetDropTarget( wxDropTarget * WXUNUSED( dropTarget ) )
|
||||||
{
|
{
|
||||||
@@ -637,7 +637,7 @@ void wxWindowQt::SetDropTarget( wxDropTarget * WXUNUSED( dropTarget ) )
|
|||||||
void wxWindowQt::SetWindowStyleFlag( long style )
|
void wxWindowQt::SetWindowStyleFlag( long style )
|
||||||
{
|
{
|
||||||
wxWindowBase::SetWindowStyleFlag( style );
|
wxWindowBase::SetWindowStyleFlag( style );
|
||||||
|
|
||||||
// wxMISSING_IMPLEMENTATION( "wxWANTS_CHARS, wxTAB_TRAVERSAL" );
|
// wxMISSING_IMPLEMENTATION( "wxWANTS_CHARS, wxTAB_TRAVERSAL" );
|
||||||
// // wxFULL_REPAINT_ON_RESIZE: Qt::WResizeNoErase (marked obsolete)
|
// // wxFULL_REPAINT_ON_RESIZE: Qt::WResizeNoErase (marked obsolete)
|
||||||
// // wxTRANSPARENT_WINDOW, wxCLIP_CHILDREN: Used in window for
|
// // wxTRANSPARENT_WINDOW, wxCLIP_CHILDREN: Used in window for
|
||||||
@@ -771,14 +771,14 @@ void wxWindowQt::DoClientToScreen( int *x, int *y ) const
|
|||||||
*y = screenPosition.y();
|
*y = screenPosition.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxWindowQt::DoScreenToClient( int *x, int *y ) const
|
void wxWindowQt::DoScreenToClient( int *x, int *y ) const
|
||||||
{
|
{
|
||||||
QPoint clientPosition = GetHandle()->mapFromGlobal( QPoint( *x, *y ));
|
QPoint clientPosition = GetHandle()->mapFromGlobal( QPoint( *x, *y ));
|
||||||
*x = clientPosition.x();
|
*x = clientPosition.x();
|
||||||
*y = clientPosition.y();
|
*y = clientPosition.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxWindowQt::DoCaptureMouse()
|
void wxWindowQt::DoCaptureMouse()
|
||||||
{
|
{
|
||||||
@@ -820,7 +820,7 @@ void wxWindowQt::DoGetSize(int *width, int *height) const
|
|||||||
if (height) *height = rect.height();
|
if (height) *height = rect.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wxWindowQt::DoSetSize(int x, int y, int width, int height, int sizeFlags )
|
void wxWindowQt::DoSetSize(int x, int y, int width, int height, int sizeFlags )
|
||||||
{
|
{
|
||||||
@@ -856,7 +856,7 @@ void wxWindowQt::DoSetSize(int x, int y, int width, int height, int sizeFlags )
|
|||||||
// if a control is created with size of zero, it is set as hidden by qt
|
// if a control is created with size of zero, it is set as hidden by qt
|
||||||
// if it is then resized, in some cases it remains hidden, so it
|
// if it is then resized, in some cases it remains hidden, so it
|
||||||
// needs to be shown here
|
// needs to be shown here
|
||||||
if (!m_qtWindow->isVisible() && IsShown())
|
if (m_qtWindow && !m_qtWindow->isVisible() && IsShown())
|
||||||
m_qtWindow->show();
|
m_qtWindow->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -868,7 +868,7 @@ void wxWindowQt::DoGetClientSize(int *width, int *height) const
|
|||||||
if (height) *height = geometry.height();
|
if (height) *height = geometry.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxWindowQt::DoSetClientSize(int width, int height)
|
void wxWindowQt::DoSetClientSize(int width, int height)
|
||||||
{
|
{
|
||||||
QWidget *qtWidget = GetHandle();
|
QWidget *qtWidget = GetHandle();
|
||||||
@@ -891,7 +891,7 @@ void wxWindowQt::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
void wxWindowQt::DoSetToolTip( wxToolTip *tip )
|
void wxWindowQt::DoSetToolTip( wxToolTip *tip )
|
||||||
{
|
{
|
||||||
wxWindowBase::DoSetToolTip( tip );
|
wxWindowBase::DoSetToolTip( tip );
|
||||||
|
|
||||||
if ( tip != NULL )
|
if ( tip != NULL )
|
||||||
GetHandle()->setToolTip( wxQtConvertString( tip->GetTip() ));
|
GetHandle()->setToolTip( wxQtConvertString( tip->GetTip() ));
|
||||||
else
|
else
|
||||||
@@ -913,15 +913,15 @@ bool wxWindowQt::DoPopupMenu(wxMenu *menu, int x, int y)
|
|||||||
void wxWindowQt::SetAcceleratorTable( const wxAcceleratorTable& accel )
|
void wxWindowQt::SetAcceleratorTable( const wxAcceleratorTable& accel )
|
||||||
{
|
{
|
||||||
wxWindowBase::SetAcceleratorTable( accel );
|
wxWindowBase::SetAcceleratorTable( accel );
|
||||||
|
|
||||||
// Disable previously set accelerators
|
// Disable previously set accelerators
|
||||||
while ( !m_qtShortcuts.isEmpty() )
|
while ( !m_qtShortcuts.isEmpty() )
|
||||||
delete m_qtShortcuts.takeFirst();
|
delete m_qtShortcuts.takeFirst();
|
||||||
|
|
||||||
// Create new shortcuts (use GetHandle() so all events inside
|
// Create new shortcuts (use GetHandle() so all events inside
|
||||||
// the window are handled, not only in the container subwindow)
|
// the window are handled, not only in the container subwindow)
|
||||||
m_qtShortcuts = accel.ConvertShortcutTable( GetHandle() );
|
m_qtShortcuts = accel.ConvertShortcutTable( GetHandle() );
|
||||||
|
|
||||||
// Connect shortcuts to window
|
// Connect shortcuts to window
|
||||||
Q_FOREACH( QShortcut *s, m_qtShortcuts )
|
Q_FOREACH( QShortcut *s, m_qtShortcuts )
|
||||||
{
|
{
|
||||||
@@ -1132,7 +1132,7 @@ bool wxWindowQt::QtHandleWheelEvent ( QWidget *WXUNUSED( handler ), QWheelEvent
|
|||||||
e.m_wheelRotation = event->delta();
|
e.m_wheelRotation = event->delta();
|
||||||
e.m_linesPerAction = 3;
|
e.m_linesPerAction = 3;
|
||||||
e.m_wheelDelta = 120;
|
e.m_wheelDelta = 120;
|
||||||
|
|
||||||
return ProcessWindowEvent( e );
|
return ProcessWindowEvent( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1152,7 +1152,7 @@ bool wxWindowQt::QtHandleKeyEvent ( QWidget *WXUNUSED( handler ), QKeyEvent *eve
|
|||||||
* Return true to avoid Qt-processing of the event
|
* Return true to avoid Qt-processing of the event
|
||||||
* Instead, use the flag to indicate that it wasn't processed */
|
* Instead, use the flag to indicate that it wasn't processed */
|
||||||
m_processingShortcut = false;
|
m_processingShortcut = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
@@ -1168,7 +1168,7 @@ bool wxWindowQt::QtHandleKeyEvent ( QWidget *WXUNUSED( handler ), QKeyEvent *eve
|
|||||||
e.m_uniChar = 0;
|
e.m_uniChar = 0;
|
||||||
else
|
else
|
||||||
e.m_uniChar = event->text().at( 0 ).unicode();
|
e.m_uniChar = event->text().at( 0 ).unicode();
|
||||||
|
|
||||||
e.m_rawCode = event->nativeVirtualKey();
|
e.m_rawCode = event->nativeVirtualKey();
|
||||||
e.m_rawFlags = event->nativeModifiers();
|
e.m_rawFlags = event->nativeModifiers();
|
||||||
|
|
||||||
@@ -1189,12 +1189,12 @@ bool wxWindowQt::QtHandleKeyEvent ( QWidget *WXUNUSED( handler ), QKeyEvent *eve
|
|||||||
* to this function. We use the m_processingShortcut flag to avoid
|
* to this function. We use the m_processingShortcut flag to avoid
|
||||||
* processing that recursive call and return back to this one. */
|
* processing that recursive call and return back to this one. */
|
||||||
m_processingShortcut = true;
|
m_processingShortcut = true;
|
||||||
|
|
||||||
QApplication::instance()->notify( GetHandle(), event );
|
QApplication::instance()->notify( GetHandle(), event );
|
||||||
|
|
||||||
handled = m_processingShortcut;
|
handled = m_processingShortcut;
|
||||||
m_processingShortcut = false;
|
m_processingShortcut = false;
|
||||||
|
|
||||||
if ( handled )
|
if ( handled )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1208,10 +1208,10 @@ bool wxWindowQt::QtHandleKeyEvent ( QWidget *WXUNUSED( handler ), QKeyEvent *eve
|
|||||||
translated = event->text().at( 0 ).toLatin1();
|
translated = event->text().at( 0 ).toLatin1();
|
||||||
if ( translated )
|
if ( translated )
|
||||||
e.m_keyCode = translated;
|
e.m_keyCode = translated;
|
||||||
|
|
||||||
handled = ProcessWindowEvent( e );
|
handled = ProcessWindowEvent( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1318,7 +1318,7 @@ bool wxWindowQt::QtHandleMouseEvent ( QWidget *handler, QMouseEvent *event )
|
|||||||
if ( mousePos.x() < 0 || mousePos.x() > handler->width() ||
|
if ( mousePos.x() < 0 || mousePos.x() > handler->width() ||
|
||||||
mousePos.y() < 0 || mousePos.y() > handler->height() )
|
mousePos.y() < 0 || mousePos.y() > handler->height() )
|
||||||
mouseInside = false;
|
mouseInside = false;
|
||||||
|
|
||||||
if ( e.GetEventType() == wxEVT_MOTION )
|
if ( e.GetEventType() == wxEVT_MOTION )
|
||||||
{
|
{
|
||||||
/* Qt doesn't emit leave/enter events while the mouse is grabbed
|
/* Qt doesn't emit leave/enter events while the mouse is grabbed
|
||||||
@@ -1339,7 +1339,7 @@ bool wxWindowQt::QtHandleMouseEvent ( QWidget *handler, QMouseEvent *event )
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_mouseInside = mouseInside;
|
m_mouseInside = mouseInside;
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1348,13 +1348,13 @@ bool wxWindowQt::QtHandleEnterEvent ( QWidget *handler, QEvent *event )
|
|||||||
wxMouseEvent e( event->type() == QEvent::Enter ? wxEVT_ENTER_WINDOW : wxEVT_LEAVE_WINDOW );
|
wxMouseEvent e( event->type() == QEvent::Enter ? wxEVT_ENTER_WINDOW : wxEVT_LEAVE_WINDOW );
|
||||||
e.m_clickCount = 0;
|
e.m_clickCount = 0;
|
||||||
e.SetPosition( wxQtConvertPoint( handler->mapFromGlobal( QCursor::pos() ) ) );
|
e.SetPosition( wxQtConvertPoint( handler->mapFromGlobal( QCursor::pos() ) ) );
|
||||||
|
|
||||||
// Mouse buttons
|
// Mouse buttons
|
||||||
wxQtFillMouseButtons( QApplication::mouseButtons(), &e );
|
wxQtFillMouseButtons( QApplication::mouseButtons(), &e );
|
||||||
|
|
||||||
// Keyboard modifiers
|
// Keyboard modifiers
|
||||||
wxQtFillKeyboardModifiers( QApplication::keyboardModifiers(), &e );
|
wxQtFillKeyboardModifiers( QApplication::keyboardModifiers(), &e );
|
||||||
|
|
||||||
return ProcessWindowEvent( e );
|
return ProcessWindowEvent( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1362,7 +1362,7 @@ bool wxWindowQt::QtHandleMoveEvent ( QWidget *handler, QMoveEvent *event )
|
|||||||
{
|
{
|
||||||
if ( GetHandle() != handler )
|
if ( GetHandle() != handler )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxMoveEvent e( wxQtConvertPoint( event->pos() ) );
|
wxMoveEvent e( wxQtConvertPoint( event->pos() ) );
|
||||||
|
|
||||||
return ProcessWindowEvent( e );
|
return ProcessWindowEvent( e );
|
||||||
@@ -1372,7 +1372,7 @@ bool wxWindowQt::QtHandleShowEvent ( QWidget *handler, QEvent *event )
|
|||||||
{
|
{
|
||||||
if ( GetHandle() != handler )
|
if ( GetHandle() != handler )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxShowEvent e;
|
wxShowEvent e;
|
||||||
e.SetShow( event->type() == QEvent::Show );
|
e.SetShow( event->type() == QEvent::Show );
|
||||||
|
|
||||||
@@ -1398,7 +1398,7 @@ bool wxWindowQt::QtHandleCloseEvent ( QWidget *handler, QCloseEvent *WXUNUSED( e
|
|||||||
{
|
{
|
||||||
if ( GetHandle() != handler )
|
if ( GetHandle() != handler )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int close = Close();
|
int close = Close();
|
||||||
if ( close )
|
if ( close )
|
||||||
{
|
{
|
||||||
@@ -1411,7 +1411,7 @@ bool wxWindowQt::QtHandleContextMenuEvent ( QWidget *WXUNUSED( handler ), QConte
|
|||||||
{
|
{
|
||||||
wxContextMenuEvent e( wxEVT_CONTEXT_MENU );
|
wxContextMenuEvent e( wxEVT_CONTEXT_MENU );
|
||||||
e.SetPosition( wxQtConvertPoint( event->globalPos() ) );
|
e.SetPosition( wxQtConvertPoint( event->globalPos() ) );
|
||||||
|
|
||||||
return ProcessWindowEvent( e );
|
return ProcessWindowEvent( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1427,7 +1427,7 @@ bool wxWindowQt::QtHandleFocusEvent ( QWidget *WXUNUSED( handler ), QFocusEvent
|
|||||||
wxChildFocusEvent childEvent( this );
|
wxChildFocusEvent childEvent( this );
|
||||||
parent->ProcessWindowEvent( childEvent );
|
parent->ProcessWindowEvent( childEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1438,7 +1438,7 @@ void wxWindowQt::QtHandleShortcut ( int command )
|
|||||||
{
|
{
|
||||||
wxCommandEvent menu_event( wxEVT_COMMAND_MENU_SELECTED, command );
|
wxCommandEvent menu_event( wxEVT_COMMAND_MENU_SELECTED, command );
|
||||||
bool ret = ProcessWindowEvent( menu_event );
|
bool ret = ProcessWindowEvent( menu_event );
|
||||||
|
|
||||||
if ( !ret )
|
if ( !ret )
|
||||||
{
|
{
|
||||||
// if the accelerator wasn't handled as menu event, try
|
// if the accelerator wasn't handled as menu event, try
|
||||||
|
Reference in New Issue
Block a user