diff --git a/UI/window-projector.cpp b/UI/window-projector.cpp index cf0d57b972de3c..cf7e0016b3277b 100644 --- a/UI/window-projector.cpp +++ b/UI/window-projector.cpp @@ -126,15 +126,12 @@ OBSProjector::~OBSProjector() } App()->DecrementSleepInhibition(); - - screen = nullptr; } void OBSProjector::SetMonitor(int monitor) { savedMonitor = monitor; - screen = QGuiApplication::screens()[monitor]; - setGeometry(screen->geometry()); + setGeometry(QGuiApplication::screens()[monitor]->geometry()); showFullScreen(); SetHideCursor(); } @@ -457,7 +454,6 @@ void OBSProjector::OpenWindowedProjector() OBSSource source = GetSource(); UpdateProjectorTitle(QT_UTF8(obs_source_get_name(source))); - screen = nullptr; } void OBSProjector::ResizeToContent() @@ -516,11 +512,11 @@ void OBSProjector::SetIsAlwaysOnTop(bool isAlwaysOnTop, bool isOverridden) SetAlwaysOnTop(this, isAlwaysOnTop); } -void OBSProjector::ScreenRemoved(QScreen *screen_) +void OBSProjector::ScreenRemoved(QScreen *screen) { - if (GetMonitor() < 0 || !screen) + if (GetMonitor() < 0) return; - if (screen == screen_) + if (screen == this->screen()) EscapeTriggered(); } diff --git a/UI/window-projector.hpp b/UI/window-projector.hpp index 8be23d4d4fa019..9c32b6d8e63410 100644 --- a/UI/window-projector.hpp +++ b/UI/window-projector.hpp @@ -45,15 +45,13 @@ class OBSProjector : public OBSQTDisplay { QRect prevGeometry; void SetMonitor(int monitor); - QScreen *screen = nullptr; - private slots: void EscapeTriggered(); void OpenFullScreenProjector(); void ResizeToContent(); void OpenWindowedProjector(); void AlwaysOnTopToggled(bool alwaysOnTop); - void ScreenRemoved(QScreen *screen_); + void ScreenRemoved(QScreen *screen); void RenameProjector(QString oldName, QString newName); public: