File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 66
66
// their CSP response headers.
67
67
static const char * scheme = " bitboxapp" ;
68
68
69
+ static QWebEngineProfile* profile;
69
70
static QWebEngineView* view;
70
71
static QWebEnginePage* mainPage;
71
72
static QWebEnginePage* externalPage;
@@ -92,7 +93,7 @@ class BitBoxApp : public SingleApplication
92
93
93
94
class WebEnginePage : public QWebEnginePage {
94
95
public:
95
- WebEnginePage (QObject* parent ) : QWebEnginePage(parent ) {}
96
+ WebEnginePage (QWebEngineProfile* profile ) : QWebEnginePage(profile ) {}
96
97
97
98
QWebEnginePage* createWindow (QWebEnginePage::WebWindowType type) {
98
99
Q_UNUSED (type);
@@ -354,7 +355,11 @@ int main(int argc, char *argv[])
354
355
}
355
356
356
357
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);
358
363
view->setPage (mainPage);
359
364
360
365
pageLoaded = false ;
@@ -464,6 +469,10 @@ int main(int argc, char *argv[])
464
469
webClass = nullptr ;
465
470
delete view;
466
471
view = nullptr ;
472
+ delete mainPage;
473
+ mainPage = nullptr ;
474
+ delete profile;
475
+ profile = nullptr ;
467
476
webClassMutex.unlock ();
468
477
backendShutdown ();
469
478
});
You can’t perform that action at this time.
0 commit comments