Skip to content

qt: persist local storage #3340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Fix wrong estimated confirmation time for ERC20 tokens.
- Enable unlock test wallet in testnet
- Added support to show on the BitBox when a transaction's recipient is an address of a different account on the device.
- Persist third party widget sessions

# v4.47.2
- Linux: fix compatiblity with some versions of Mesa that are incompatible with the bundled wayland libraries
Expand Down
12 changes: 10 additions & 2 deletions frontends/qt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
// their CSP response headers.
static const char* scheme = "bitboxapp";

static QWebEngineProfile* profile;
static QWebEngineView* view;
static QWebEnginePage* mainPage;
static QWebEnginePage* externalPage;
Expand All @@ -91,7 +92,7 @@ class BitBoxApp : public SingleApplication

class WebEnginePage : public QWebEnginePage {
public:
WebEnginePage(QObject* parent) : QWebEnginePage(parent) {}
WebEnginePage(QWebEngineProfile* profile) : QWebEnginePage(profile) {}

QWebEnginePage* createWindow(QWebEnginePage::WebWindowType type) {
Q_UNUSED(type);
Expand Down Expand Up @@ -353,7 +354,8 @@ int main(int argc, char *argv[])
}

externalPage = new QWebEnginePage(view);
mainPage = new WebEnginePage(view);
profile = new QWebEngineProfile("BitBoxApp");
mainPage = new WebEnginePage(profile);
view->setPage(mainPage);

pageLoaded = false;
Expand Down Expand Up @@ -459,6 +461,12 @@ int main(int argc, char *argv[])
webClass = nullptr;
delete view;
view = nullptr;
// Make sure mainPage is deleted before the profile. This is a requirement for the profile
// to be able to flush to disk properly.
delete mainPage;
mainPage = nullptr;
delete profile;
profile = nullptr;
webClassMutex.unlock();
backendShutdown();
});
Expand Down