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:
@@ -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);
|
||||
}
|
||||
|
@@ -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_) {}
|
||||
};
|
||||
|
Reference in New Issue
Block a user