Skip to content

Commit f8773bd

Browse files
committed
qt: use persisted profile, not off-the-record
1 parent 78f5d11 commit f8773bd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

frontends/qt/main.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
// their CSP response headers.
6767
static const char* scheme = "bitboxapp";
6868

69+
static QWebEngineProfile* profile;
6970
static QWebEngineView* view;
7071
static QWebEnginePage* mainPage;
7172
static QWebEnginePage* externalPage;
@@ -92,7 +93,7 @@ class BitBoxApp : public SingleApplication
9293

9394
class WebEnginePage : public QWebEnginePage {
9495
public:
95-
WebEnginePage(QObject* parent) : QWebEnginePage(parent) {}
96+
WebEnginePage(QWebEngineProfile* profile) : QWebEnginePage(profile) {}
9697

9798
QWebEnginePage* createWindow(QWebEnginePage::WebWindowType type) {
9899
Q_UNUSED(type);
@@ -354,7 +355,11 @@ int main(int argc, char *argv[])
354355
}
355356

356357
externalPage = new QWebEnginePage(view);
357-
mainPage = new WebEnginePage(view);
358+
359+
profile = new QWebEngineProfile("BitBoxApp");
360+
// Set parent to profile, making sure mainPage is deleted before the profile. This is a requirement for
361+
// the profile to be able to flush to disk properly.
362+
mainPage = new WebEnginePage(profile);
358363
view->setPage(mainPage);
359364

360365
pageLoaded = false;
@@ -464,6 +469,10 @@ int main(int argc, char *argv[])
464469
webClass = nullptr;
465470
delete view;
466471
view = nullptr;
472+
delete mainPage;
473+
mainPage = nullptr;
474+
delete profile;
475+
profile = nullptr;
467476
webClassMutex.unlock();
468477
backendShutdown();
469478
});

0 commit comments

Comments
 (0)