mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-04 08:35:21 +00:00
Fix crash in SelfDestructionBox.
base::lambda_guarded may destroy the lambda after the owner. In case of SelfDestructionBox it lead to a dtor of a dangling object_ptr. MTP::Sender destroys the lambda handlers together with itself.
This commit is contained in:
@@ -44,7 +44,7 @@ void SelfDestructionBox::prepare() {
|
|||||||
|
|
||||||
addButton(lang(lng_cancel), [this] { closeBox(); });
|
addButton(lang(lng_cancel), [this] { closeBox(); });
|
||||||
|
|
||||||
MTP::send(MTPaccount_GetAccountTTL(), rpcDone(base::lambda_guarded(this, [this, loading = std::move(loading)](const MTPAccountDaysTTL &result) mutable {
|
request(MTPaccount_GetAccountTTL()).done([this, loading = std::move(loading)](const MTPAccountDaysTTL &result) mutable {
|
||||||
Expects(result.type() == mtpc_accountDaysTTL);
|
Expects(result.type() == mtpc_accountDaysTTL);
|
||||||
Expects(!_ttlValues.empty());
|
Expects(!_ttlValues.empty());
|
||||||
|
|
||||||
@@ -77,5 +77,5 @@ void SelfDestructionBox::prepare() {
|
|||||||
closeBox();
|
closeBox();
|
||||||
});
|
});
|
||||||
addButton(lang(lng_cancel), [this] { closeBox(); });
|
addButton(lang(lng_cancel), [this] { closeBox(); });
|
||||||
})));
|
}).send();
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "boxes/abstractbox.h"
|
#include "boxes/abstractbox.h"
|
||||||
|
#include "mtproto/sender.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class RadiobuttonGroup;
|
class RadiobuttonGroup;
|
||||||
@@ -28,7 +29,7 @@ class Radiobutton;
|
|||||||
class FlatLabel;
|
class FlatLabel;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
class SelfDestructionBox : public BoxContent {
|
class SelfDestructionBox : public BoxContent, private MTP::Sender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user