mirror of
https://github.com/Qz3rK/tdesktop.git
synced 2026-07-03 14:15:08 +02:00
Closed beta 1000014001: fixed crash in MTP destructor.
Some of MTP::Instance::Private fields access _instance in destructors. All that cleanup should be performed before the Instance::~Instance() (which invalidates _private) is called.
This commit is contained in:
@@ -102,8 +102,7 @@ public:
|
||||
void completedKeyDestroy(ShiftedDcId shiftedDcId);
|
||||
|
||||
void clearKilledSessions();
|
||||
|
||||
~Private();
|
||||
void prepareToDestroy();
|
||||
|
||||
private:
|
||||
bool hasAuthorization();
|
||||
@@ -1189,7 +1188,7 @@ void Instance::Private::clearGlobalHandlers() {
|
||||
setSessionResetHandler(base::lambda<void(ShiftedDcId)>());
|
||||
}
|
||||
|
||||
Instance::Private::~Private() {
|
||||
void Instance::Private::prepareToDestroy() {
|
||||
for (auto &session : base::take(_sessions)) {
|
||||
session.second->kill();
|
||||
}
|
||||
@@ -1371,6 +1370,8 @@ void Instance::onClearKilledSessions() {
|
||||
_private->clearKilledSessions();
|
||||
}
|
||||
|
||||
Instance::~Instance() = default;
|
||||
Instance::~Instance() {
|
||||
_private->prepareToDestroy();
|
||||
}
|
||||
|
||||
} // namespace MTP
|
||||
|
||||
Reference in New Issue
Block a user