delaying setView seems to save some crashes

svn path=/trunk/KDE/kdelibs/; revision=1100837
This commit is contained in:
Marco Martin 2010-03-08 20:16:41 +00:00
parent f7169d811c
commit 2116cf8681
2 changed files with 8 additions and 1 deletions

View File

@ -50,6 +50,7 @@ public:
void loadingFinished(bool success);
void dragTimeoutExpired();
void delayedViewSync();
WebView *q;
AnimableGraphicsWebView *webView;
@ -263,7 +264,7 @@ QVariant WebView::itemChange(GraphicsItemChange change, const QVariant &value)
//FIXME: QWebPage _requires_ a QWidget view to not crash in places such as
// WebCore::PopupMenu::show() due to hostWindow()->platformPageClient() == NULL
// because QWebPage::d->client is NULL
d->webView->page()->setView(viewFor(this));
QTimer::singleShot(0, this, SLOT(delayedViewSync()));
}
return QGraphicsWidget::itemChange(change, value);
}
@ -291,6 +292,11 @@ void WebViewPrivate::loadingFinished(bool success)
q->update();
}
void WebViewPrivate::delayedViewSync()
{
webView->page()->setView(viewFor(q));
}
} // namespace Plasma
#include "webview.moc"

View File

@ -216,6 +216,7 @@ class PLASMA_EXPORT WebView : public QGraphicsWidget
private:
Q_PRIVATE_SLOT(d, void loadingFinished(bool success))
Q_PRIVATE_SLOT(d, void delayedViewSync())
WebViewPrivate * const d;
friend class WebViewPrivate;