mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Fixed possible crash on quit application when media preview is opened.
This commit is contained in:
@@ -60,8 +60,10 @@ struct PreviewOverlayState {
|
||||
base::unique_qptr<Ui::AbstractButton> background;
|
||||
base::unique_qptr<Ui::FlatLabel> label;
|
||||
Fn<void()> extraHide;
|
||||
rpl::lifetime shutdownGuard;
|
||||
|
||||
void clear() {
|
||||
shutdownGuard.destroy();
|
||||
menu.reset();
|
||||
background.reset();
|
||||
label.reset();
|
||||
@@ -108,6 +110,11 @@ template <typename MediaData>
|
||||
clickableRaw->raise();
|
||||
}, clickableRaw->lifetime());
|
||||
|
||||
// Prevent running state destructor from within a child widget's
|
||||
// destructor, which would trigger a double-delete through unique_qptr.
|
||||
mainwidget->death() | rpl::on_next([s = state] {
|
||||
}, state->shutdownGuard);
|
||||
|
||||
return { state, hideAll };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user