Qt: Fix memory leak

This commit is contained in:
Vicki Pfau 2017-07-27 22:55:15 -07:00
parent e9c393b876
commit 9dc8b9e854
1 changed files with 2 additions and 5 deletions

View File

@ -1722,11 +1722,8 @@ void Window::setController(CoreController* controller, const QString& fname) {
connect(m_controller.get(), &CoreController::started, &m_inputController, &InputController::suspendScreensaver);
connect(m_controller.get(), &CoreController::stopping, this, &Window::gameStopped);
{
std::shared_ptr<CoreController> controller(m_controller);
connect(m_controller.get(), &CoreController::stopping, [this, controller]() {
if (m_controller == controller) {
m_controller.reset();
}
connect(m_controller.get(), &CoreController::stopping, [this]() {
m_controller.reset();
});
}
connect(m_controller.get(), &CoreController::stopping, &m_inputController, &InputController::resumeScreensaver);