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,7 +184,7 @@ void FixPopupMenuNativeEmojiPopup(not_null<PopupMenu*> menu) {
void SetGeometryWithPossibleScreenChange( void SetGeometryWithPossibleScreenChange(
not_null<QWidget*> widget, not_null<QWidget*> widget,
QRect geometry) { QRect geometry) {
const auto screen = QGuiApplication::screenAt(geometry.center()); if (const auto screen = QGuiApplication::screenAt(geometry.center())) {
const auto window = widget->window(); const auto window = widget->window();
window->createWinId(); window->createWinId();
const auto handle = window->windowHandle(); const auto handle = window->windowHandle();
@ -193,6 +193,7 @@ void SetGeometryWithPossibleScreenChange(
window->move(screen->availableGeometry().topLeft()); window->move(screen->availableGeometry().topLeft());
window->show(); window->show();
} }
}
widget->setGeometry(geometry); widget->setGeometry(geometry);
} }