summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-09-16 17:04:31 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-09-16 17:05:00 +0200
commitb219b24f587877d41d5a371585acdf63d994e2c0 (patch)
tree84261047b40072049693678c5f68551b9d443179
parentSearch with default searchEngine in errorPage (diff)
downloadrekonq-b219b24f587877d41d5a371585acdf63d994e2c0.tar.xz
Get sure mainWindow() exists before trying applying settings
BUG: 272107
-rw-r--r--src/adblock/adblockmanager.h4
-rw-r--r--src/application.cpp26
2 files changed, 19 insertions, 11 deletions
diff --git a/src/adblock/adblockmanager.h b/src/adblock/adblockmanager.h
index 1736b2f3..216764eb 100644
--- a/src/adblock/adblockmanager.h
+++ b/src/adblock/adblockmanager.h
@@ -64,7 +64,7 @@
// There are 3 kind of filter options:
//
// --- ### TYPE OPTIONS
-//
+//
// You can also specify a number of options to modify the behavior of a filter.
// You list these options separated with commas after a dollar sign ($) at the end of the filter
//
@@ -87,7 +87,7 @@
//
//
// --- ### INVERSE TYPE OPTIONS
-//
+//
// Inverse type options are allowed through the ~ sign, for example:
//
// RULE=*/ads/*~$script,match-case
diff --git a/src/application.cpp b/src/application.cpp
index 2d8cddb2..627536da 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -545,16 +545,19 @@ void Application::updateConfiguration()
// compute font size
// (I have to admit I know nothing about these DPI questions..: copied from kwebkitpart, as someone suggested)
// font size in pixels = font size in inches × screen dpi
- int defaultFontSize = ReKonfig::defaultFontSize();
- int minimumFontSize = ReKonfig::minFontSize();
+ if (mainWindow() && mainWindow()->currentTab())
+ {
+ int logDpiY = mainWindow()->currentTab()->view()->logicalDpiY();
+ float toPix = (logDpiY < 96.0)
+ ? 96.0 / 72.0
+ : logDpiY / 72.0 ;
- int logDpiY = mainWindow()->currentTab()->view()->logicalDpiY();
- float toPix = (logDpiY < 96.0)
- ? 96.0 / 72.0
- : logDpiY / 72.0 ;
+ int defaultFontSize = ReKonfig::defaultFontSize();
+ int minimumFontSize = ReKonfig::minFontSize();
- defaultSettings->setFontSize(QWebSettings::DefaultFontSize, qRound(defaultFontSize * toPix));
- defaultSettings->setFontSize(QWebSettings::MinimumFontSize, qRound(minimumFontSize * toPix));
+ defaultSettings->setFontSize(QWebSettings::DefaultFontSize, qRound(defaultFontSize * toPix));
+ defaultSettings->setFontSize(QWebSettings::MinimumFontSize, qRound(minimumFontSize * toPix));
+ }
// encodings
QString enc = ReKonfig::defaultEncoding();
@@ -599,6 +602,12 @@ void Application::updateConfiguration()
// ====== load Settings on main classes
historyManager()->loadSettings();
+
+ defaultSettings = 0;
+
+ if (!mainWindow())
+ return;
+
if (!ReKonfig::useFavicon())
mainWindow()->setWindowIcon(KIcon("rekonq"));
else
@@ -634,7 +643,6 @@ void Application::updateConfiguration()
break;
}
- defaultSettings = 0;
}