UI: Use null with sendPostedEvents()

After stepping into this function with a debugger, it's been determined
that App() won't do anything because it'll marked as a recursive call,
and 'this' will only clear events for this specific object. Instead, we
should be using nullptr to send all posted events for the program.

This fixes an issue where posted events would not be processed on
shutdown as expected before destroying the main window.
This commit is contained in:
jp9000 2021-12-21 01:38:08 -08:00
parent 1604a8d362
commit fb58e58892

View file

@ -960,7 +960,7 @@ void OBSBasic::LoadData(obs_data_t *data, const char *file)
devicePropertiesThread.reset();
}
QApplication::sendPostedEvents(this);
QApplication::sendPostedEvents(nullptr);
OBSDataAutoRelease modulesObj = obs_data_get_obj(data, "modules");
if (api)
@ -2554,7 +2554,7 @@ void OBSBasic::ClearHotkeys()
OBSBasic::~OBSBasic()
{
/* clear out UI event queue */
QApplication::sendPostedEvents(App());
QApplication::sendPostedEvents(nullptr);
if (updateCheckThread && updateCheckThread->isRunning())
updateCheckThread->wait();
@ -2637,7 +2637,7 @@ OBSBasic::~OBSBasic()
* but Qt doesn't use C++ in a normal way, so you can't really rely on
* normal C++ behavior for your data to be freed in the order that you
* expect or want it to. */
QApplication::sendPostedEvents(this);
QApplication::sendPostedEvents(nullptr);
config_set_int(App()->GlobalConfig(), "General", "LastVersion",
LIBOBS_API_VER);
@ -4641,7 +4641,7 @@ void OBSBasic::closeEvent(QCloseEvent *event)
devicePropertiesThread.reset();
}
QApplication::sendPostedEvents(this);
QApplication::sendPostedEvents(nullptr);
signalHandlers.clear();