From c554f3348cd0baea8221e668d41132cea0833a8a Mon Sep 17 00:00:00 2001 From: Viktor Engelmann Date: Mon, 20 Mar 2017 11:52:38 +0100 Subject: Delegate QWebEngineHistory::currentItem() to itemAt() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calling QWebEngineHistory::currentItem() before the first item is inserted, caused a segfault, due to accessing an illegal QList index. We now delegate the lookup to QWebEngineHistory::itemAt(), which checks the index first and returns a dummy element in case of an illegal index. Task-number: QTBUG-59599 Change-Id: I9cdd2533e33415a7b812c29fff5429eb005020dc Reviewed-by: Michael BrĂ¼ning --- src/webenginewidgets/api/qwebenginehistory.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/webenginewidgets/api/qwebenginehistory.cpp b/src/webenginewidgets/api/qwebenginehistory.cpp index 41de8c90b..48ddbc48e 100644 --- a/src/webenginewidgets/api/qwebenginehistory.cpp +++ b/src/webenginewidgets/api/qwebenginehistory.cpp @@ -226,9 +226,7 @@ QWebEngineHistoryItem QWebEngineHistory::backItem() const QWebEngineHistoryItem QWebEngineHistory::currentItem() const { - Q_D(const QWebEngineHistory); - d->updateItems(); - return d->items[currentItemIndex()]; + return itemAt(currentItemIndex()); } QWebEngineHistoryItem QWebEngineHistory::forwardItem() const -- cgit v1.2.3