From b16447b13d1d471a1f6351edcd346ee5a09bfc01 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 20 May 2018 21:12:06 -0400 Subject: [PATCH] Fix occasional crash when favicon progress dialog is closed (#1980) * Changed progress dialog to a true percentage calculation * Removed some unnecessary code --- src/gui/EditWidgetIcons.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gui/EditWidgetIcons.cpp b/src/gui/EditWidgetIcons.cpp index 837d6ef5c..b13c8ba37 100644 --- a/src/gui/EditWidgetIcons.cpp +++ b/src/gui/EditWidgetIcons.cpp @@ -45,16 +45,13 @@ UrlFetchProgressDialog::UrlFetchProgressDialog(const QUrl &url, QWidget *parent) setWindowTitle(tr("Download Progress")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setLabelText(tr("Downloading %1.").arg(url.toDisplayString())); - setMinimum(0); - setValue(0); - setMinimumDuration(0); + setMinimumDuration(2000); setMinimumSize(QSize(400, 75)); } void UrlFetchProgressDialog::networkReplyProgress(qint64 bytesRead, qint64 totalBytes) { - setMaximum(totalBytes); - setValue(bytesRead); + setValue(static_cast(bytesRead / totalBytes)); } EditWidgetIcons::EditWidgetIcons(QWidget* parent) @@ -280,7 +277,9 @@ void EditWidgetIcons::fetchFinished() void EditWidgetIcons::fetchCanceled() { #ifdef WITH_XC_NETWORKING - m_reply->abort(); + if (m_reply) { + m_reply->abort(); + } #endif }