Track properties window lifetime via QPointer

Previously the properties window would sometimes not receive
a closeEvent, leaving a dangling pointer in OBSBasicMain (and resulting
in a crash when trying to open a new properties window or closing
the application)
This commit is contained in:
Palana 2014-04-16 17:18:11 +02:00
parent 785d81ffe2
commit be55c06308
4 changed files with 3 additions and 15 deletions

View File

@ -979,8 +979,3 @@ config_t OBSBasic::Config() const
{
return basicConfig;
}
void OBSBasic::UnloadProperties()
{
properties = nullptr;
}

View File

@ -25,6 +25,8 @@
#include <util/util.hpp>
#include <QPointer>
class QListWidgetItem;
#include "ui_OBSBasic.h"
@ -45,7 +47,7 @@ private:
ConfigFile basicConfig;
OBSBasicProperties *properties;
QPointer<OBSBasicProperties> properties;
void GetFPSCommon(uint32_t &num, uint32_t &den) const;
void GetFPSInteger(uint32_t &num, uint32_t &den) const;
@ -103,8 +105,6 @@ public:
void SaveProject();
void LoadProject();
void UnloadProperties();
protected:
virtual void closeEvent(QCloseEvent *event) override;
virtual void changeEvent(QEvent *event) override;

View File

@ -78,12 +78,6 @@ void OBSBasicProperties::DrawPreview(void *data, uint32_t cx, uint32_t cy)
gs_matrix_pop();
}
void OBSBasicProperties::closeEvent(QCloseEvent *event)
{
main->UnloadProperties();
UNUSED_PARAMETER(event);
}
void OBSBasicProperties::resizeEvent(QResizeEvent *event)
{
if (isVisible()) {

View File

@ -50,7 +50,6 @@ public:
void Init();
protected:
virtual void closeEvent(QCloseEvent *event) override;
virtual void resizeEvent(QResizeEvent *event) override;
virtual void timerEvent(QTimerEvent *event) override;
};