mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-22 16:26:52 +00:00
Don't start animations from QEvent::Enter.
The enter/leave events may be sent from ~QWidget() and if we start animating something with grabbing of widgets it crashes sometimes.
This commit is contained in:
parent
03775e0cc5
commit
2eb64e051b
@ -68,6 +68,7 @@ private:
|
|||||||
const Fn<void(bool)> _menuOverCallback;
|
const Fn<void(bool)> _menuOverCallback;
|
||||||
base::unique_qptr<Ui::DropdownMenu> _menu;
|
base::unique_qptr<Ui::DropdownMenu> _menu;
|
||||||
bool _temporarilyHidden = false;
|
bool _temporarilyHidden = false;
|
||||||
|
bool _overButton = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -120,9 +121,17 @@ WithDropdownController::WithDropdownController(
|
|||||||
, _menuOverCallback(std::move(menuOverCallback)) {
|
, _menuOverCallback(std::move(menuOverCallback)) {
|
||||||
button->events(
|
button->events(
|
||||||
) | rpl::filter([=](not_null<QEvent*> e) {
|
) | rpl::filter([=](not_null<QEvent*> e) {
|
||||||
return (e->type() == QEvent::Enter);
|
return (e->type() == QEvent::Enter)
|
||||||
}) | rpl::start_with_next([=] {
|
|| (e->type() == QEvent::Leave);
|
||||||
showMenu();
|
}) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||||
|
_overButton = (e->type() == QEvent::Enter);
|
||||||
|
if (_overButton) {
|
||||||
|
InvokeQueued(button, [=] {
|
||||||
|
if (_overButton) {
|
||||||
|
showMenu();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}, button->lifetime());
|
}, button->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -740,7 +749,9 @@ void Widget::markOver(bool over) {
|
|||||||
if (over) {
|
if (over) {
|
||||||
_over = true;
|
_over = true;
|
||||||
_wontBeOver = false;
|
_wontBeOver = false;
|
||||||
updateControlsWrapVisibility();
|
InvokeQueued(this, [=] {
|
||||||
|
updateControlsWrapVisibility();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
_wontBeOver = true;
|
_wontBeOver = true;
|
||||||
InvokeQueued(this, [=] {
|
InvokeQueued(this, [=] {
|
||||||
|
Loading…
Reference in New Issue
Block a user