今天使用 QWebView 来做个简易的浏览器,出现了几个崩溃的问题,我的 Qt 版本是最新的5.4.2,相信 5.3.2 或者更低版本也会出现这些问题。
问题重现:
1、QWebView::load(URL),当界面还没加载完的时候,双击此控件会出现崩溃;
2、当 load() 过程中,界面出现垂直滚动条而又未完全加载完成的时间,使用鼠标滑轮或者直接拖动滚动条至最顶或者最底时出现崩溃(有些页面出现)。
崩溃的堆栈如下:
Qt5WebKitd.dll!WTFCrash() 行 345 C++ Qt5WebKitd.dll!WebCore::NoExceptionAssertionChecker::~NoExceptionAssertionChecker() 行 48 C++ Qt5WebKitd.dll!WebCore::Range::Range(WTF::PassRefPtr<WebCore::Document> ownerDocument, WTF::PassRefPtr<WebCore::Node> startContainer, int startOffset, WTF::PassRefPtr<WebCore::Node> endContainer, int endOffset) 行 96 C++ Qt5WebKitd.dll!WebCore::Range::create(WTF::PassRefPtr<WebCore::Document> ownerDocument, WTF::PassRefPtr<WebCore::Node> startContainer, int startOffset, WTF::PassRefPtr<WebCore::Node> endContainer, int endOffset) 行 101 C++ Qt5WebKitd.dll!WebCore::SimplifiedBackwardsTextIterator::range() 行 1368 C++ Qt5WebKitd.dll!WebCore::previousBoundary(const WebCore::VisiblePosition & c, unsigned int (const wchar_t *, unsigned int, unsigned int, WebCore::BoundarySearchContextAvailability, bool &) * searchFunction) 行 513 C++ Qt5WebKitd.dll!WebCore::startOfWord(const WebCore::VisiblePosition & c, WebCore::EWordSide side) 行 639 C++ Qt5WebKitd.dll!WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity(WebCore::TextGranularity granularity) 行 299 C++ Qt5WebKitd.dll!WebCore::VisibleSelection::validate(WebCore::TextGranularity granularity) 行 418 C++ Qt5WebKitd.dll!WebCore::VisibleSelection::expandUsingGranularity(WebCore::TextGranularity granularity) 行 198 C++ Qt5WebKitd.dll!WebCore::EventHandler::selectClosestWordFromHitTestResult(const WebCore::HitTestResult & result, WebCore::AppendTrailingWhitespace appendTrailingWhitespace) 行 495 C++ Qt5WebKitd.dll!WebCore::EventHandler::selectClosestWordFromMouseEvent(const WebCore::MouseEventWithHitTestResults & result) 行 508 C++ Qt5WebKitd.dll!WebCore::EventHandler::handleMousePressEventDoubleClick(const WebCore::MouseEventWithHitTestResults & event) 行 543 C++ Qt5WebKitd.dll!WebCore::EventHandler::handleMousePressEvent(const WebCore::MouseEventWithHitTestResults & event) 行 708 C++ Qt5WebKitd.dll!WebCore::EventHandler::handleMousePressEvent(const WebCore::PlatformMouseEvent & mouseEvent) 行 1636 C++ Qt5WebKitd.dll!QWebPageAdapter::mouseDoubleClickEvent(QMouseEvent * ev) 行 547 C++ Qt5WebKitWidgetsd.dll!QWebPage::event(QEvent * ev) 行 2564 C++ Qt5WebKitWidgetsd.dll!QWebView::mouseDoubleClickEvent(QMouseEvent * ev) 行 886 C++ Qt5Widgetsd.dll!QWidget::event(QEvent * event) 行 8662 C++ Qt5WebKitWidgetsd.dll!QWebView::event(QEvent * e) 行 734 C++ Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) 行 3720 C++ Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) 行 3280 C++ Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) 行 935 C++ > Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) 行 231 C++ Qt5Widgetsd.dll!QApplicationPrivate::sendMouseEvent(QWidget * receiver, QMouseEvent * event, QWidget * alienWidget, QWidget * nativeWidget, QWidget * * buttonDown, QPointer<QWidget> & lastMouseReceiver, bool spontaneous) 行 2751 C++ Qt5Widgetsd.dll!QWidgetWindow::handleMouseEvent(QMouseEvent * event) 行 543 C++ Qt5Widgetsd.dll!QWidgetWindow::event(QEvent * event) 行 211 C++ Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) 行 3720 C++ Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) 行 3164 C++ Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) 行 935 C++ Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) 行 231 C++ Qt5Guid.dll!QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent * e) 行 1812 C++ Qt5Guid.dll!QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent * e) 行 1573 C++ Qt5Guid.dll!QWindowSystemInterface::sendWindowSystemEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) 行 572 C++ qwindowsd.dll!QWindowsGuiEventDispatcher::sendPostedEvents() 行 82 C++ Qt5Cored.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned int wp, long lp) 行 414 C++ [外部代码] [下面的框架可能不正确和/或缺失,没有为 user32.dll 加载符号] Qt5Cored.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) 行 807 C++ qwindowsd.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) 行 73 C++ Qt5Cored.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) 行 129 C++ Qt5Cored.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) 行 204 C++ Qt5Cored.dll!QCoreApplication::exec() 行 1188 C++ Qt5Guid.dll!QGuiApplication::exec() 行 1508 C++ Qt5Widgetsd.dll!QApplication::exec() 行 2957 C++ MiniBrowser.exe!main(int argc, char * * argv) 行 39 C++ MiniBrowser.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) 行 113 C++ [外部代码]
Qt5WebKitd.dll!WTFCrash() 行 345 C++ Qt5WebKitd.dll!WebCore::RenderLayer::updateLayerPositionsAfterScroll(WebCore::RenderGeometryMap * geometryMap, unsigned int flags) 行 812 C++ Qt5WebKitd.dll!WebCore::RenderLayer::updateLayerPositionsAfterScroll(WebCore::RenderGeometryMap * geometryMap, unsigned int flags) 行 816 C++ Qt5WebKitd.dll!WebCore::RenderLayer::updateLayerPositionsAfterScroll(WebCore::RenderGeometryMap * geometryMap, unsigned int flags) 行 816 C++ Qt5WebKitd.dll!WebCore::RenderLayer::updateLayerPositionsAfterScroll(WebCore::RenderGeometryMap * geometryMap, unsigned int flags) 行 816 C++ Qt5WebKitd.dll!WebCore::RenderLayer::updateLayerPositionsAfterScroll(WebCore::RenderGeometryMap * geometryMap, unsigned int flags) 行 816 C++ Qt5WebKitd.dll!WebCore::RenderLayer::updateLayerPositionsAfterScroll(WebCore::RenderGeometryMap * geometryMap, unsigned int flags) 行 816 C++ Qt5WebKitd.dll!WebCore::RenderLayer::updateLayerPositionsAfterDocumentScroll() 行 763 C++ Qt5WebKitd.dll!WebCore::FrameView::repaintFixedElementsAfterScrolling() 行 2071 C++ Qt5WebKitd.dll!WebCore::ScrollView::scrollTo(const WebCore::IntSize & newOffset) 行 398 C++ Qt5WebKitd.dll!WebCore::FrameView::scrollTo(const WebCore::IntSize & newOffset) 行 3113 C++ Qt5WebKitd.dll!WebCore::ScrollView::setScrollOffset(const WebCore::IntPoint & offset) 行 379 C++ Qt5WebKitd.dll!WebCore::ScrollableArea::scrollPositionChanged(const WebCore::IntPoint & position) 行 147 C++ Qt5WebKitd.dll!WebCore::ScrollableArea::setScrollOffsetFromAnimation(const WebCore::IntPoint & offset) 行 191 C++ Qt5WebKitd.dll!WebCore::ScrollAnimator::notifyPositionChanged(const WebCore::FloatSize & delta) 行 143 C++ Qt5WebKitd.dll!WebCore::ScrollAnimator::scroll(WebCore::ScrollbarOrientation orientation, WebCore::ScrollGranularity __formal, float step, float multiplier) 行 73 C++ Qt5WebKitd.dll!WebCore::ScrollAnimator::handleWheelEvent(const WebCore::PlatformWheelEvent & e) 行 115 C++ Qt5WebKitd.dll!WebCore::ScrollableArea::handleWheelEvent(const WebCore::PlatformWheelEvent & wheelEvent) 行 177 C++ Qt5WebKitd.dll!WebCore::FrameView::wheelEvent(const WebCore::PlatformWheelEvent & wheelEvent) 行 4188 C++ Qt5WebKitd.dll!WebCore::EventHandler::handleWheelEvent(const WebCore::PlatformWheelEvent & e) 行 2463 C++ Qt5WebKitd.dll!QWebPageAdapter::wheelEvent(QWheelEvent * ev, int wheelScrollLines) 行 616 C++ Qt5WebKitWidgetsd.dll!QWebPage::event(QEvent * ev) 行 2614 C++ Qt5WebKitWidgetsd.dll!QWebView::wheelEvent(QWheelEvent * ev) 行 922 C++ Qt5Widgetsd.dll!QWidget::event(QEvent * event) 行 8666 C++ Qt5WebKitWidgetsd.dll!QWebView::event(QEvent * e) 行 734 C++ Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) 行 3720 C++ Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) 行 3339 C++ Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) 行 935 C++ > Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) 行 231 C++ Qt5Widgetsd.dll!QWidgetWindow::handleWheelEvent(QWheelEvent * event) 行 715 C++ Qt5Widgetsd.dll!QWidgetWindow::event(QEvent * event) 行 238 C++ Qt5Widgetsd.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) 行 3720 C++ Qt5Widgetsd.dll!QApplication::notify(QObject * receiver, QEvent * e) 行 3164 C++ Qt5Cored.dll!QCoreApplication::notifyInternal(QObject * receiver, QEvent * event) 行 935 C++ Qt5Cored.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver, QEvent * event) 行 231 C++ Qt5Guid.dll!QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent * e) 行 1845 C++ Qt5Guid.dll!QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent * e) 行 1576 C++ Qt5Guid.dll!QWindowSystemInterface::sendWindowSystemEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) 行 572 C++ qwindowsd.dll!QWindowsGuiEventDispatcher::sendPostedEvents() 行 82 C++ Qt5Cored.dll!qt_internal_proc(HWND__ * hwnd, unsigned int message, unsigned int wp, long lp) 行 414 C++ [外部代码] [下面的框架可能不正确和/或缺失,没有为 user32.dll 加载符号] Qt5Cored.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) 行 807 C++ qwindowsd.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) 行 73 C++ Qt5Cored.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) 行 129 C++ Qt5Cored.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) 行 204 C++ Qt5Cored.dll!QCoreApplication::exec() 行 1188 C++ Qt5Guid.dll!QGuiApplication::exec() 行 1508 C++ Qt5Widgetsd.dll!QApplication::exec() 行 2957 C++ MiniBrowser.exe!main(int argc, char * * argv) 行 39 C++ MiniBrowser.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) 行 113 C++ [外部代码]
从以上可以看到,最后崩的地方都是:Qt5WebKitd.dll!WTFCrash() 行 345
解决方法:
load() 之前使用 hide() 隐藏控件,当 loadFinished(bool ok) 事件触发的时候才显示出来,就不会崩溃了。
最后,广告时间,帮朋友推广网站:无忧仓库
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-08 09:46:44