diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index b6a8775af..1ad6c68bf 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -653,15 +653,13 @@ void OBSBasic::OBSInit() TimedCheckForUpdates(); loaded = true; - QTimer *timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(SaveProject())); - timer->start(20000); + saveTimer = new QTimer(this); + connect(saveTimer, SIGNAL(timeout()), this, SLOT(SaveProject())); + saveTimer->start(20000); } OBSBasic::~OBSBasic() { - SaveProject(); - /* XXX: any obs data must be released before calling obs_shutdown. * currently, we can't automate this with C++ RAII because of the * delicate nature of obs_shutdown needing to be freed before the UI @@ -1659,6 +1657,11 @@ void OBSBasic::closeEvent(QCloseEvent *event) // remove draw callback in case our drawable surfaces go away before // the destructor gets called obs_remove_draw_callback(OBSBasic::RenderMain, this); + + /* Delete the save timer so it doesn't trigger after this point while + * the program data is being freed */ + delete saveTimer; + SaveProject(); } void OBSBasic::changeEvent(QEvent *event) diff --git a/obs/window-basic-main.hpp b/obs/window-basic-main.hpp index 08f6523c2..da43b89b6 100644 --- a/obs/window-basic-main.hpp +++ b/obs/window-basic-main.hpp @@ -61,6 +61,8 @@ private: bool loaded = false; + QPointer saveTimer; + QPointer interaction; QPointer properties; QPointer transformWindow;