GH-1854 prevent a crash if the instance is closed while the kill confirmation dialog is open

This commit is contained in:
Petr Mrázek 2017-04-14 10:41:52 +02:00
parent be53eb66f8
commit 910766458d
2 changed files with 3 additions and 2 deletions

View File

@ -1001,7 +1001,8 @@ bool MultiMC::kill(InstancePtr instance)
return false;
}
auto & extras = m_instanceExtras[instance->id()];
auto & controller = extras.controller;
// NOTE: copy of the shared pointer keeps it alive
auto controller = extras.controller;
if(controller)
{
return controller->abort();

View File

@ -214,7 +214,7 @@ private:
struct InstanceXtras
{
InstanceWindow * window = nullptr;
unique_qobject_ptr<LaunchController> controller;
shared_qobject_ptr<LaunchController> controller;
};
std::map<QString, InstanceXtras> m_instanceExtras;
size_t m_openWindows = 0;