Fix crash in scale preview reparenting.

This commit is contained in:
John Preston 2023-11-22 13:01:19 +04:00
parent 4b5e2582d9
commit db0a31b87e

View file

@ -169,12 +169,13 @@ void Preview::watchParent() {
} }
void Preview::reparent() { void Preview::reparent() {
if (_widget.window() == &_widget) { const auto parent = _widget.parentWidget();
if (!parent) {
// macOS just removes parenting for a _window. // macOS just removes parenting for a _window.
_parentWatcher = nullptr; _parentWatcher = nullptr;
return; return;
} }
_widget.setParent(_widget.window()); _widget.setParent(parent->window(), _widget.windowFlags());
if (_shown) { if (_shown) {
_widget.show(); _widget.show();
updateGlobalPosition(); updateGlobalPosition();