summaryrefslogtreecommitdiff
diff options
authorPatrick Luby <guibmacdev@gmail.com>2025-04-27 17:02:18 -0400
committerPatrick Luby <guibomacdev@gmail.com>2025-04-28 03:25:59 +0200
commitb4eb737f07d85fcc583dffefb0d5489d859690ae (patch)
tree4e571934e5e0082055e7416a8e83b38058b0c60c
parentd9435d2759e78b716b64bfccdecaac3f3f1a0e4d (diff)
Related: tdf#165448 move parent window to front after closing window
When a floating window such as the dropdown list in the font combobox is open when selecting any of the menu items inserted by macOS in the windows menu, the parent window will be hidden. So if there is a key window, force the key window back to the front. Previously, delaying closing of the window was used to avoid this bug, but that caused Skia/Metal to crash when the window was released before the delayed close occurred. This crash was found when rapidly dragging the border between two column headings side to side in a Calc document. Change-Id: I8511fe73e59c49f57d9179f5308e4b7a393809b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184690 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
-rw-r--r--vcl/osx/salframe.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 08517cb837e7..69c31ede4715 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -555,13 +555,22 @@ void AquaSalFrame::Show(bool bVisible, bool bNoActivate)
// Ordering out a native full screen window would leave the
// application in a state where there is no Desktop and both
// the menubar and the Dock are hidden.
- // Related: tdf#165448 delay closing the window
+ [mpNSWindow close];
+
+ // Related: tdf#165448 move parent window to front after closing window
// When a floating window such as the dropdown list in the
// font combobox is open when selecting any of the menu items
// inserted by macOS in the windows menu, the parent window
- // will be hidden. So delay closing the window until the next
- // pass through the native event loop.
- [mpNSWindow performSelector: @selector(close) withObject: nil afterDelay: 0.01f];
+ // will be hidden. So if there is a key window, force the key
+ // window back to the front.
+ // Previously, delaying closing of the window was used to avoid
+ // this bug, but that caused Skia/Metal to crash when the
+ // window was released before the delayed close occurred. This
+ // crash was found when rapidly dragging the border between two
+ // column headings side to side in a Calc document.
+ NSWindow *pKeyWin = [NSApp keyWindow];
+ if( pKeyWin )
+ [pKeyWin orderFront: NSApp];
}
}
close