fix a crash when setting focus if prev is null
This commit is contained in:
parent
1446849454
commit
75800b2e78
@ -927,12 +927,15 @@ namespace detail
|
|||||||
arg.receiver = wd->root;
|
arg.receiver = wd->root;
|
||||||
brock.emit(event_code::focus, prev_focus, arg, true, brock.get_thread_context());
|
brock.emit(event_code::focus, prev_focus, arg, true, brock.get_thread_context());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check the prev_focus again, because it may be closed in focus event
|
||||||
|
if (!impl_->wd_register.available(prev_focus))
|
||||||
|
prev_focus = nullptr;
|
||||||
}
|
}
|
||||||
else if(wd->root == native_interface::get_focus_window())
|
else if(wd->root == native_interface::get_focus_window())
|
||||||
wd = nullptr; //no new focus_window
|
return prev_focus; //no new focus_window
|
||||||
|
|
||||||
|
|
||||||
if(wd)
|
|
||||||
{
|
|
||||||
if(wd->together.caret)
|
if(wd->together.caret)
|
||||||
wd->together.caret->set_active(true);
|
wd->together.caret->set_active(true);
|
||||||
|
|
||||||
@ -949,12 +952,12 @@ namespace detail
|
|||||||
//focus window is a menubar.
|
//focus window is a menubar.
|
||||||
//The focus window will be restore to the prev focus which losts the focus becuase of
|
//The focus window will be restore to the prev focus which losts the focus becuase of
|
||||||
//memberbar.
|
//memberbar.
|
||||||
if (wd == wd->root_widget->other.attribute.root->menubar)
|
if (prev_focus && (wd == wd->root_widget->other.attribute.root->menubar))
|
||||||
wd = prev_focus;
|
wd = prev_focus;
|
||||||
|
|
||||||
if (wd != wd->root_widget->other.attribute.root->menubar)
|
if (wd != wd->root_widget->other.attribute.root->menubar)
|
||||||
brock.set_menubar_taken(wd);
|
brock.set_menubar_taken(wd);
|
||||||
}
|
|
||||||
return prev_focus;
|
return prev_focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user