Fix possible crash.

This commit is contained in:
John Preston 2024-01-18 22:21:44 +04:00
parent 30b22ace0b
commit a2c2d92cda

View file

@ -184,14 +184,15 @@ void FixPopupMenuNativeEmojiPopup(not_null<PopupMenu*> menu) {
void SetGeometryWithPossibleScreenChange(
not_null<QWidget*> widget,
QRect geometry) {
const auto screen = QGuiApplication::screenAt(geometry.center());
const auto window = widget->window();
window->createWinId();
const auto handle = window->windowHandle();
if (handle->screen() != screen) {
handle->setScreen(screen);
window->move(screen->availableGeometry().topLeft());
window->show();
if (const auto screen = QGuiApplication::screenAt(geometry.center())) {
const auto window = widget->window();
window->createWinId();
const auto handle = window->windowHandle();
if (handle->screen() != screen) {
handle->setScreen(screen);
window->move(screen->availableGeometry().topLeft());
window->show();
}
}
widget->setGeometry(geometry);
}