Fix crash in theme applying.

This commit is contained in:
John Preston 2018-09-26 16:06:30 +03:00
parent 7ec4d9af3e
commit a949c5e287
1 changed files with 5 additions and 1 deletions

View File

@ -909,7 +909,11 @@ void KeepApplied() {
if (!AreTestingTheme()) {
return;
} else if (instance->applying.overrideKeep) {
instance->applying.overrideKeep();
// This callback will be destroyed while running.
// And it won't be able to safely access captures after that.
// So we save it on stack for the time while it is running.
const auto saved = base::take(instance->applying.overrideKeep);
saved();
return;
}
const auto path = instance->applying.pathAbsolute;