From e976ffac5b0270005e51b0714a822b4809256eaa Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Mon, 10 Jan 2022 19:49:04 -0500 Subject: [PATCH] Changed playback pauseFrame variable and accessor functions to be static in PLAYBACK class so that they are thread safe for Qt GUI. --- src/drivers/Qt/TasEditor/playback.cpp | 1 + src/drivers/Qt/TasEditor/playback.h | 4 ++-- src/drivers/Qt/fceuWrapper.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/drivers/Qt/TasEditor/playback.cpp b/src/drivers/Qt/TasEditor/playback.cpp index 060a5f03..8f5a9659 100644 --- a/src/drivers/Qt/TasEditor/playback.cpp +++ b/src/drivers/Qt/TasEditor/playback.cpp @@ -36,6 +36,7 @@ extern bool turbo; // resources static char upperMarkerText[] = "Marker "; +int PLAYBACK::pauseFrame = 0; PLAYBACK::PLAYBACK() { diff --git a/src/drivers/Qt/TasEditor/playback.h b/src/drivers/Qt/TasEditor/playback.h index 98824c8f..d2056fd2 100644 --- a/src/drivers/Qt/TasEditor/playback.h +++ b/src/drivers/Qt/TasEditor/playback.h @@ -62,7 +62,7 @@ public: int getLastPosition(); // actually returns lost_position_frame-1 void setLastPosition(int frame); - int getPauseFrame(); + static int getPauseFrame(); int getFlashingPauseFrame(); void setProgressbar(int a, int b); @@ -76,7 +76,7 @@ public: private: bool setPlaybackAboveOrToFrame(int frame, bool forceStateReload = false); - int pauseFrame; + static int pauseFrame; int lastPositionFrame; bool lastPositionIsStable; // for when Greenzone invalidates several times, but the end of current segment must remain the same diff --git a/src/drivers/Qt/fceuWrapper.cpp b/src/drivers/Qt/fceuWrapper.cpp index 5ad2cfa9..ebe19e61 100644 --- a/src/drivers/Qt/fceuWrapper.cpp +++ b/src/drivers/Qt/fceuWrapper.cpp @@ -1200,7 +1200,7 @@ static void DoFun(int frameskip, int periodic_saves) { int runToFrameTarget; - runToFrameTarget = tasWin->playback.getPauseFrame(); + runToFrameTarget = PLAYBACK::getPauseFrame(); if ( runToFrameTarget >= 0) {