Dereferencing pointer focused_widget

This commit is contained in:
Markus Gans 2017-06-14 01:23:10 +02:00
parent bd10bc74c5
commit 28cdbc77af
5 changed files with 10 additions and 22 deletions

View File

@ -373,14 +373,12 @@ void FButton::onAccel (FAccelEvent* ev)
{
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
if ( focused_widget->isWidget() )
if ( focused_widget && focused_widget->isWidget() )
{
FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
setFocus();
if ( focused_widget )
focused_widget->redraw();
focused_widget->redraw();
if ( click_animation )
setDown();

View File

@ -220,15 +220,12 @@ void FLabel::onAccel (FAccelEvent* ev)
{
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
if ( focused_widget->isWidget() )
if ( focused_widget && focused_widget->isWidget() )
{
FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
accel_widget->setFocus();
if ( focused_widget )
focused_widget->redraw();
focused_widget->redraw();
accel_widget->redraw();
FFocusEvent in (fc::FocusIn_Event);
FApplication::sendEvent(accel_widget, &in);

View File

@ -542,15 +542,12 @@ void FLineEdit::onAccel (FAccelEvent* ev)
{
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
if ( focused_widget->isWidget() )
if ( focused_widget && focused_widget->isWidget() )
{
FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
setFocus();
if ( focused_widget )
focused_widget->redraw();
focused_widget->redraw();
redraw();
if ( getStatusBar() )

View File

@ -543,7 +543,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
focused_widget = static_cast<FWidget*>(ev->focusedWidget());
if ( focused_widget->isWidget() )
if ( focused_widget && focused_widget->isWidget() )
{
FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
@ -553,9 +553,7 @@ void FMenuItem::onAccel (FAccelEvent* ev)
if ( menu->getSelectedItem() )
menu->getSelectedItem()->setFocus();
if ( focused_widget )
focused_widget->redraw();
focused_widget->redraw();
menu->redraw();
if ( getStatusBar() )

View File

@ -298,14 +298,12 @@ void FToggleButton::onAccel (FAccelEvent* ev)
{
FWidget* focused_widget = static_cast<FWidget*>(ev->focusedWidget());
if ( focused_widget->isWidget() )
if ( focused_widget && focused_widget->isWidget() )
{
FFocusEvent out (fc::FocusOut_Event);
FApplication::queueEvent(focused_widget, &out);
setFocus();
if ( focused_widget )
focused_widget->redraw();
focused_widget->redraw();
}
}