summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Fries <David@Fries.net>2014-07-11 10:59:44 -0500
committerDavid Fries <david@fries.net>2014-07-12 14:04:20 +0200
commit20558f56823e28c0c28043ed5ba06b29bebe348b (patch)
tree5cce12adfd6304c59e9d0cfb5dc0f06315019de6
parentcb0f788597a946438bfd993850426f848ff39aa2 (diff)
downloadqtwebkit-20558f56823e28c0c28043ed5ba06b29bebe348b.tar.gz
QWebPage crashes on drag without QWidget view
QWebPage can be used without a widgets and has a documentation section on how to do so, but if QWegPage hasn't been given a QWidget in setView a drag operation will crash. To reproduce select a section of the web page click and drag from within the selection and it will crash. Add a check to avoid a NULL dereference, the existing code already has a check for not having a QWidget set as the view. DragClientQt::startDrag m_chromeClient->platformPageClient() is NULL Task-number: QTBUG-40204 Change-Id: I5739285696ab57c05ee59c10ae00a1cf652ff494 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
-rw-r--r--Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp
index 479c79cd2..11a805f53 100644
--- a/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp
@@ -95,7 +95,8 @@ void DragClientQt::startDrag(DragImageRef dragImage, const IntPoint& dragImageOr
#ifndef QT_NO_DRAGANDDROP
QMimeData* clipboardData = clipboard->pasteboard().clipboardData();
clipboard->pasteboard().invalidateWritableData();
- QObject* view = m_chromeClient->platformPageClient()->ownerWidget();
+ PlatformPageClient pageClient = m_chromeClient->platformPageClient();
+ QObject* view = pageClient ? pageClient->ownerWidget() : 0;
if (view) {
QDrag* drag = new QDrag(view);
if (dragImage) {