From 0378fa229d817abe2128e920e7091e53e1e0919f Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 30 May 2015 00:34:53 -0700 Subject: [PATCH] Qt: Cap the maximum number of multiplayer windows --- CHANGES | 1 + src/platform/qt/GBAApp.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 28f3473b8..13b17da45 100644 --- a/CHANGES +++ b/CHANGES @@ -31,6 +31,7 @@ Bugfixes: - Qt: Better cleanup when a game crashes - Qt: Fix open ROM dialog filtering for archive formats - ARM7: Fix Thumb MUL timing + - Qt: Cap the maximum number of multiplayer windows Misc: - Qt: Handle saving input settings better - Debugger: Free watchpoints in addition to breakpoints diff --git a/src/platform/qt/GBAApp.cpp b/src/platform/qt/GBAApp.cpp index 91a95390b..89ad0c4f5 100644 --- a/src/platform/qt/GBAApp.cpp +++ b/src/platform/qt/GBAApp.cpp @@ -67,7 +67,10 @@ bool GBAApp::event(QEvent* event) { return QApplication::event(event); } -Window* GBAApp::newWindowInternal() { +Window* GBAApp::newWindow() { + if (m_multiplayer.attached() >= MAX_GBAS) { + return nullptr; + } Window* w = new Window(&m_configController, m_multiplayer.attached()); m_windows[m_multiplayer.attached()] = w; w->setAttribute(Qt::WA_DeleteOnClose);