Skip to content

Commit fd169e2

Browse files
mepardvitallium
authored andcommitted
Fix crash running subwindows test
See ariya#13882
1 parent 20d673b commit fd169e2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/phantom.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,15 @@ void Phantom::doExit(int code)
522522
emit aboutToExit(code);
523523
m_terminated = true;
524524
m_returnValue = code;
525-
foreach(QPointer<WebPage> page, m_pages) {
525+
526+
// Iterate in reverse order so the first page is the last one scheduled for deletion.
527+
// The first page is the root object, which will be invalidated when it is deleted.
528+
// This causes an assertion to go off in BridgeJSC.cpp Instance::createRuntimeObject.
529+
QListIterator<QPointer<WebPage> > i(m_pages);
530+
i.toBack();
531+
while (i.hasPrevious()) {
532+
const QPointer<WebPage> page = i.previous();
533+
526534
if (!page) {
527535
continue;
528536
}

0 commit comments

Comments
 (0)