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:
parent
785d81ffe2
commit
be55c06308
@ -979,8 +979,3 @@ config_t OBSBasic::Config() const
|
||||
{
|
||||
return basicConfig;
|
||||
}
|
||||
|
||||
void OBSBasic::UnloadProperties()
|
||||
{
|
||||
properties = nullptr;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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()) {
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user