UI: Destroy save timer before closing main window
This prevents the save timer from unexpectedly going off during the middle of the save process.master
parent
7014076169
commit
c4ef2522ad
|
@ -653,15 +653,13 @@ void OBSBasic::OBSInit()
|
||||||
TimedCheckForUpdates();
|
TimedCheckForUpdates();
|
||||||
loaded = true;
|
loaded = true;
|
||||||
|
|
||||||
QTimer *timer = new QTimer(this);
|
saveTimer = new QTimer(this);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(SaveProject()));
|
connect(saveTimer, SIGNAL(timeout()), this, SLOT(SaveProject()));
|
||||||
timer->start(20000);
|
saveTimer->start(20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
OBSBasic::~OBSBasic()
|
OBSBasic::~OBSBasic()
|
||||||
{
|
{
|
||||||
SaveProject();
|
|
||||||
|
|
||||||
/* XXX: any obs data must be released before calling obs_shutdown.
|
/* XXX: any obs data must be released before calling obs_shutdown.
|
||||||
* currently, we can't automate this with C++ RAII because of the
|
* currently, we can't automate this with C++ RAII because of the
|
||||||
* delicate nature of obs_shutdown needing to be freed before the UI
|
* 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
|
// remove draw callback in case our drawable surfaces go away before
|
||||||
// the destructor gets called
|
// the destructor gets called
|
||||||
obs_remove_draw_callback(OBSBasic::RenderMain, this);
|
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)
|
void OBSBasic::changeEvent(QEvent *event)
|
||||||
|
|
|
@ -61,6 +61,8 @@ private:
|
||||||
|
|
||||||
bool loaded = false;
|
bool loaded = false;
|
||||||
|
|
||||||
|
QPointer<QTimer> saveTimer;
|
||||||
|
|
||||||
QPointer<OBSBasicInteraction> interaction;
|
QPointer<OBSBasicInteraction> interaction;
|
||||||
QPointer<OBSBasicProperties> properties;
|
QPointer<OBSBasicProperties> properties;
|
||||||
QPointer<OBSBasicTransform> transformWindow;
|
QPointer<OBSBasicTransform> transformWindow;
|
||||||
|
|
Loading…
Reference in New Issue