Details
Description
Set QWebView in QDockWidget and call QWebView->load("something url").
Move the QDockWidget to top level( QDockWidget::setFloating(true) ) and then return back (QDockWidget::setFloating(false) ), will crash.
Simple test:
#include <QApplication> #include <QDockWidget> #include <QMainWindow> #include <QtWebKitWidgets/QWebView> #include <QTimer> class DoCrash : public QObject{ Q_OBJECT public: DoCrash( QDockWidget* widget ) :m_dockWidget( widget ){} public slots: void startCrach(){ m_dockWidget->setFloating( true ); QTimer::singleShot( 100, this, SLOT(doCrash()) ); } private slots: void doCrash(){ m_dockWidget->setFloating( false ); } private: QDockWidget* m_dockWidget; }; int main(int argc, char *argv[]) { QApplication a(argc, argv); QMainWindow mainWindow; QDockWidget* dockWidget = new QDockWidget( &mainWindow ); dockWidget->setFeatures( QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable ); QWebView* view = new QWebView( dockWidget ); view->load( QUrl("http://www.google.com") ); dockWidget->setWidget( view ); mainWindow.addDockWidget( Qt::BottomDockWidgetArea, dockWidget ); DoCrash crash( dockWidget ); mainWindow.show(); QTimer::singleShot( 10, &crash, SLOT(startCrach()) ); return a.exec(); }
My solution:
class QWebPagePrivate{ .... QWindow* window; -> QPointer< QWindow > window; // It's work. };
Attachments
Issue Links
- replaces
-
QTBUG-40011 To move a dockable window with a QWebView in it from one dock site to another will eventually crash your application
- Closed
For Gerrit Dashboard: QTBUG-39524 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
88074,2 | Prevent crashes when the QWebView gets reparented. | 5.3 | qt/qtwebkit | Status: MERGED | +2 | 0 |