Skip to content

Commit

Permalink
[qtmozembed] Avoid sending orientation signal on scene changes. Fixes…
Browse files Browse the repository at this point in the history
… JB#57688

Emitting an orientationChange signal when the QuickMozView is added to a
scene can cause a segmentation fault, because the QML engine isn't ready
to be activated.

This change ensures the orientation is set correctly, but without
emitting the signal.
  • Loading branch information
llewelld committed Mar 7, 2022
1 parent d536219 commit eed2b5c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/quickmozview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ void QuickMozView::itemChange(ItemChange change, const ItemChangeData &data)
if (data.window) {
connect(data.window, &QQuickWindow::contentOrientationChanged, this, &QuickMozView::updateOrientation);

// Update the orientation, but without emitting an orientationChanged signal
// Emitting the signal at this point will cause a SIGSEGV because
// the QML item isn't ready to be activated just yet, see JB#57688
blockSignals(true);
updateOrientation(data.window->contentOrientation());
blockSignals(false);
}
}
QQuickItem::itemChange(change, data);
Expand Down

1 comment on commit eed2b5c

@poetaster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering is this is the cause of webviews no longer obtaining orientation changes (noted in > .64 on 10ii and volla).

I noticed that not only size is not being calculated correctly, but also orientation does not change. Tested with


function getOrientation(){
...
var orientation = window.screen.orientation.type
...
}

window.onresize = function(){ getOrientation(); }

Testtool: https://github.com/poetaster/webview-screensize

Please sign in to comment.