summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-04-14 10:41:52 +0200
committerPetr Mrázek <peterix@gmail.com>2017-04-14 10:41:52 +0200
commit910766458de68c37c8c4dab13c584c4c68502cd0 (patch)
tree685efbed01904e09cb989896e9e0259570922623 /application
parentbe53eb66f8a63730f4def5640db6205678b4e9d8 (diff)
downloadMultiMC-910766458de68c37c8c4dab13c584c4c68502cd0.tar
MultiMC-910766458de68c37c8c4dab13c584c4c68502cd0.tar.gz
MultiMC-910766458de68c37c8c4dab13c584c4c68502cd0.tar.lz
MultiMC-910766458de68c37c8c4dab13c584c4c68502cd0.tar.xz
MultiMC-910766458de68c37c8c4dab13c584c4c68502cd0.zip
GH-1854 prevent a crash if the instance is closed while the kill confirmation dialog is open
Diffstat (limited to 'application')
-rw-r--r--application/MultiMC.cpp3
-rw-r--r--application/MultiMC.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index 942b1d93..42f0c93d 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -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();
diff --git a/application/MultiMC.h b/application/MultiMC.h
index a9cbdec7..28a9641a 100644
--- a/application/MultiMC.h
+++ b/application/MultiMC.h
@@ -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;