UI: Fix closing OBS before showing whats new dialog

The program can get stuck waiting for the browser within a event queue,
so instead mark that the program is closing, do it in a separate thread,
signal the window when it's finished, and then check whether it's in the
process of closing before actually showing the dialog.
This commit is contained in:
jp9000
2020-03-16 08:46:47 -07:00
parent 8faaf8491a
commit 0fb34ed965
4 changed files with 70 additions and 3 deletions

View File

@@ -20,8 +20,15 @@
#include <winhttp.h>
#include <shellapi.h>
#ifdef BROWSER_AVAILABLE
#include <browser-panel.hpp>
#endif
using namespace std;
struct QCef;
extern QCef *cef;
/* ------------------------------------------------------------------------ */
#ifndef WIN_MANIFEST_URL
@@ -799,3 +806,13 @@ try {
} catch (string &text) {
blog(LOG_WARNING, "%s: %s", __FUNCTION__, text.c_str());
}
/* ------------------------------------------------------------------------ */
void WhatsNewBrowserInitThread::run()
{
#ifdef BROWSER_AVAILABLE
cef->wait_for_browser_init();
#endif
emit Result(url);
}

View File

@@ -33,3 +33,17 @@ signals:
public:
inline WhatsNewInfoThread() {}
};
class WhatsNewBrowserInitThread : public QThread {
Q_OBJECT
QString url;
virtual void run() override;
signals:
void Result(const QString &url);
public:
inline WhatsNewBrowserInitThread(const QString &url_) : url(url_) {}
};