2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 23:45:44 +00:00

Improve base::binary_guard interface.

This commit is contained in:
John Preston
2019-03-27 16:11:38 +04:00
parent efb2972d28
commit d3bf489bea
12 changed files with 38 additions and 54 deletions

View File

@@ -408,13 +408,14 @@ void Widget::step_shift(float64 ms, bool timer) {
void Widget::hideSlow() {
if (anim::Disabled()) {
_hiding = true;
auto [left, right] = base::make_binary_guard();
_hidingDelayed = std::move(left);
App::CallDelayed(st::notifySlowHide, this, [=, guard = std::move(right)] {
if (guard && _hiding) {
hideFast();
}
});
App::CallDelayed(
st::notifySlowHide,
this,
[=, guard = _hidingDelayed.make_guard()] {
if (guard && _hiding) {
hideFast();
}
});
} else {
hideAnimated(st::notifySlowHide, anim::easeInCirc);
}