From: Soren Stoutner Date: Mon, 29 May 2023 19:31:00 +0000 (-0700) Subject: Fix crash when closing second window with loading tab. https://redmine.stoutner... X-Git-Tag: v0.4~4 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=75a38db8a253d1458aaa5a2811afb58bc4eb7855;p=PrivacyBrowserPC.git Fix crash when closing second window with loading tab. https://redmine.stoutner.com/issues/1010 --- diff --git a/doc/index.docbook b/doc/index.docbook index c9bc6b4..8a88368 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -317,7 +317,8 @@ Privacy Browser blocks all HTTP pings and presents a dialog informing the user every time the current tab attempts to send one. Hopefully, as more people become aware of what HTTP pings are, web sites will become more embarrassed about using them. - This is a classic example of how those who wrote the HTTP specs do not have the best interests of internet users at heart. I would like the day to come where they are removed from the specs. + This is a classic example of how those who wrote the HTTP specs do not have the best interests of internet users at heart. I would like the day to come when this is removed from both the internet and the spec. + Here is an example of me raising the issue with F-Droid. @@ -1243,7 +1244,8 @@ - 0.3 - 8 May 2023 + <ulink url="https://www.stoutner.com/privacy-browser-pc-0-3/">0.3</ulink> - + <ulink url="https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=commitdiff;h=ace098e8677ac0d6468b825c73e65b82c0d6993e">8 May 2023</ulink> Add the changelog to the Handbook. diff --git a/src/widgets/TabWidget.cpp b/src/widgets/TabWidget.cpp index 28a6cf2..05f10d2 100644 --- a/src/widgets/TabWidget.cpp +++ b/src/widgets/TabWidget.cpp @@ -47,7 +47,7 @@ QString TabWidget::webEngineDefaultUserAgent = QLatin1String(""); // Construct the class. -TabWidget::TabWidget(QWidget *parent) : QWidget(parent) +TabWidget::TabWidget(QWidget *windowPointer) : QWidget(windowPointer) { // Create a QProcess to check if KDE is running. QProcess *checkIfRunningKdeQProcessPointer = new QProcess(); @@ -94,6 +94,9 @@ TabWidget::TabWidget(QWidget *parent) : QWidget(parent) // Set the loading favorite icon movie file name. loadingFavoriteIconMoviePointer->setFileName(QStringLiteral(":/icons/loading.gif")); + // Stop the loading favorite icon movie if the window is destroyed. Otherwise, the app will crash if there is more than one window open and a window is closed while at tab is loading. + connect(windowPointer, SIGNAL(destroyed()), this, SLOT(stopLoadingFavoriteIconMovie())); + // Add the first tab. addFirstTab(); @@ -741,6 +744,12 @@ void TabWidget::pageLinkHovered(const QString &linkUrl) const emit linkHovered(linkUrl); } +void TabWidget::stopLoadingFavoriteIconMovie() const +{ + // Stop the loading favorite icon movie. Otherwise, the browser will crash if a second window is closed while a tab in it is loading. + loadingFavoriteIconMoviePointer->stop(); +} + void TabWidget::print() const { // Create a printer. diff --git a/src/widgets/TabWidget.h b/src/widgets/TabWidget.h index f0efc1d..ea9efe5 100644 --- a/src/widgets/TabWidget.h +++ b/src/widgets/TabWidget.h @@ -45,7 +45,7 @@ class TabWidget : public QWidget public: // The primary contructor. - explicit TabWidget(QWidget *parent); + explicit TabWidget(QWidget *windowPointer); // The destructor. ~TabWidget(); @@ -121,6 +121,7 @@ private Q_SLOTS: void pageLinkHovered(const QString &linkUrl) const; void printWebpage(QPrinter *printerPointer) const; void showSaveDialog(QWebEngineDownloadItem *downloadItemPointer); + void stopLoadingFavoriteIconMovie() const; void updateUiFromWebEngineView(const PrivacyWebEngineView *privacyWebEngineViewPointer) const; void updateUiWithTabSettings(); void useNativeKdeDownloader(QUrl &downloadUrl, QString &suggestedFileName);