diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-02-17 10:24:46 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-02-17 10:24:46 +0100 |
commit | a2ad510b44017f9b6290eb3d22cacdb1e1732128 (patch) | |
tree | 1eb70cd52838475492c592d7f1a2a915894f74d8 /src/mainwindow.cpp | |
parent | Again, QKeySequence --> KShortcut (diff) | |
download | rekonq-a2ad510b44017f9b6290eb3d22cacdb1e1732128.tar.xz |
Please, don't crash on CTRL+W signals :)
BUG:227323
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 48d89f49..5237a20d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1052,27 +1052,33 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) m_popup->layout()->setMargin(margin); // useful values - + WebTab *tab = m_view->currentWebTab(); + + // fix crash on window close + if(!tab) + return; + // fix crash on window close - if(!m_view->currentWebTab()->page()->currentFrame()) + if(!tab->page()) return; - bool scrollbarIsVisible = m_view->currentWebTab()->page()->currentFrame()->scrollBarMaximum(Qt::Horizontal); + bool scrollbarIsVisible = tab->page()->currentFrame()->scrollBarMaximum(Qt::Horizontal); int scrollbarSize = 0; if (scrollbarIsVisible) { //TODO: detect QStyle size scrollbarSize = 17; } - QPoint webViewOrigin = m_view->currentWebTab()->view()->mapToGlobal(QPoint(0,0)); - int bottomLeftY=webViewOrigin.y() + m_view->currentWebTab()->page()->viewportSize().height() - labelSize.height() - scrollbarSize; + + QPoint webViewOrigin = tab->view()->mapToGlobal(QPoint(0,0)); + int bottomLeftY = webViewOrigin.y() + tab->page()->viewportSize().height() - labelSize.height() - scrollbarSize; // setting popup in bottom-left position int x = geometry().x(); int y = bottomLeftY; - QPoint mousePos = m_view->currentWebTab()->mapToGlobal(m_view->currentWebTab()->view()->mousePos()); - if(QRect(webViewOrigin.x(),bottomLeftY,labelSize.width(),labelSize.height()).contains(mousePos)) + QPoint mousePos = tab->mapToGlobal( tab->view()->mousePos() ); + if( QRect( webViewOrigin.x() , bottomLeftY , labelSize.width() , labelSize.height() ).contains(mousePos) ) { // setting popup above the mouse y = bottomLeftY - labelSize.height(); |