Change window visibility only when owns display

Before this the visibility was changed if the window pointed to a
display without taking into account that it might not own it. Fix #4805
This commit is contained in:
Martín Capello 2024-11-21 17:10:13 -03:00
parent 7038ab501e
commit 45c2a59504

View File

@ -717,8 +717,11 @@ void Window::onSetText()
void Window::onVisible(bool visible)
{
Widget::onVisible(visible);
if (get_multiple_displays() && m_display) {
display()->nativeWindow()->setVisible(visible);
Display* display = this->display();
if (ownDisplay() &&
display &&
display->nativeWindow()) {
display->nativeWindow()->setVisible(visible);
}
}