Fix possible crash.
This commit is contained in:
parent
30b22ace0b
commit
a2c2d92cda
1 changed files with 9 additions and 8 deletions
|
|
@ -184,14 +184,15 @@ 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();
|
||||||
if (handle->screen() != screen) {
|
if (handle->screen() != screen) {
|
||||||
handle->setScreen(screen);
|
handle->setScreen(screen);
|
||||||
window->move(screen->availableGeometry().topLeft());
|
window->move(screen->availableGeometry().topLeft());
|
||||||
window->show();
|
window->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
widget->setGeometry(geometry);
|
widget->setGeometry(geometry);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue