aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLC <[email protected]>2020-08-29 01:33:29 -0400
committerGitHub <[email protected]>2020-08-29 01:33:29 -0400
commitce43139eb7f347c853713699dfe05a500dc7f240 (patch)
treee33c12c1ea8408dce12de19ca141149472fb92c9
parent01de4fa26a19095c059862ee047aec34603fdd77 (diff)
parentbcd3c79eca66c911cf5eb9c593b63ab60e46d783 (diff)
downloadyuzu-mainline-ce43139eb7f347c853713699dfe05a500dc7f240.tar.gz
yuzu-mainline-ce43139eb7f347c853713699dfe05a500dc7f240.zip
Merge pull request #4604 from lioncash/lifetime
yuzu/main: Amend lifetime issues with InputSubsystem
-rw-r--r--src/yuzu/bootmanager.cpp4
-rw-r--r--src/yuzu/bootmanager.h5
-rw-r--r--src/yuzu/main.cpp4
-rw-r--r--src/yuzu/main.h2
4 files changed, 8 insertions, 7 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index f1b428bde..32b548c56 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -305,8 +305,8 @@ static Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow*
}
GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_,
- InputCommon::InputSubsystem* input_subsystem_)
- : QWidget(parent), emu_thread(emu_thread_), input_subsystem{input_subsystem_} {
+ std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_)
+ : QWidget(parent), emu_thread(emu_thread_), input_subsystem{std::move(input_subsystem_)} {
setWindowTitle(QStringLiteral("yuzu %1 | %2-%3")
.arg(QString::fromUtf8(Common::g_build_name),
QString::fromUtf8(Common::g_scm_branch),
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index ecb3b8135..ca35cf831 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -6,6 +6,7 @@
#include <atomic>
#include <condition_variable>
+#include <memory>
#include <mutex>
#include <QImage>
@@ -126,7 +127,7 @@ class GRenderWindow : public QWidget, public Core::Frontend::EmuWindow {
public:
explicit GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_,
- InputCommon::InputSubsystem* input_subsystem_);
+ std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_);
~GRenderWindow() override;
// EmuWindow implementation.
@@ -188,7 +189,7 @@ private:
QStringList GetUnsupportedGLExtensions() const;
EmuThread* emu_thread;
- InputCommon::InputSubsystem* input_subsystem;
+ std::shared_ptr<InputCommon::InputSubsystem> input_subsystem;
// Main context that will be shared with all other contexts that are requested.
// If this is used in a shared context setting, then this should not be used directly, but
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index cab9d680a..a1b61d119 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -187,7 +187,7 @@ static void InitializeLogging() {
}
GMainWindow::GMainWindow()
- : input_subsystem{std::make_unique<InputCommon::InputSubsystem>()},
+ : input_subsystem{std::make_shared<InputCommon::InputSubsystem>()},
config{std::make_unique<Config>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()},
provider{std::make_unique<FileSys::ManualContentProvider>()} {
InitializeLogging();
@@ -474,7 +474,7 @@ void GMainWindow::InitializeWidgets() {
#ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING
ui.action_Report_Compatibility->setVisible(true);
#endif
- render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem.get());
+ render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem);
render_window->hide();
game_list = new GameList(vfs, provider.get(), this);
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 957f20fa8..0ce66a1ca 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -258,7 +258,7 @@ private:
Ui::MainWindow ui;
std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc;
- std::unique_ptr<InputCommon::InputSubsystem> input_subsystem;
+ std::shared_ptr<InputCommon::InputSubsystem> input_subsystem;
GRenderWindow* render_window;
GameList* game_list;