mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-06-22 10:02:20 +00:00
Merge 2061db10fc into 2b40c61d8e
This commit is contained in:
commit
fde4f515fb
2 changed files with 30 additions and 7 deletions
|
|
@ -1779,15 +1779,29 @@ Future<void> saveWindowPosition(WindowType type,
|
|||
// if is not resizable. The reason is unknown.
|
||||
//
|
||||
// `setResizable(!bind.isIncomingOnly());` in main.dart
|
||||
isMaximized =
|
||||
bind.isIncomingOnly() ? false : await windowManager.isMaximized();
|
||||
// On Linux, the GtkWindow may already be destroyed when this is called
|
||||
// during onWindowClose (via _saveFrame(flush: true)). Querying a destroyed
|
||||
// window causes SIGSEGV in the native plugin. Guard with try-catch and
|
||||
// fall back to the last saved position if the window is no longer available.
|
||||
try {
|
||||
isMaximized =
|
||||
bind.isIncomingOnly() ? false : await windowManager.isMaximized();
|
||||
} catch (e) {
|
||||
debugPrint('Failed to query isMaximized (window may be closing): $e');
|
||||
isMaximized = false;
|
||||
}
|
||||
if (isFullscreen || isMaximized) {
|
||||
setPreFrame();
|
||||
} else {
|
||||
position = await windowManager.getPosition(
|
||||
ignoreDevicePixelRatio: _ignoreDevicePixelRatio);
|
||||
sz = await windowManager.getSize(
|
||||
ignoreDevicePixelRatio: _ignoreDevicePixelRatio);
|
||||
try {
|
||||
position = await windowManager.getPosition(
|
||||
ignoreDevicePixelRatio: _ignoreDevicePixelRatio);
|
||||
sz = await windowManager.getSize(
|
||||
ignoreDevicePixelRatio: _ignoreDevicePixelRatio);
|
||||
} catch (e) {
|
||||
debugPrint('Failed to query window position/size (window may be closing): $e');
|
||||
setPreFrame();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -432,7 +432,16 @@ class _DesktopTabState extends State<DesktopTab>
|
|||
|
||||
@override
|
||||
void onWindowClose() async {
|
||||
mainWindowClose() async => await windowManager.hide();
|
||||
// On Linux, the GtkWindow may already be destroyed at this point.
|
||||
// Calling hide() on a destroyed window causes GTK CRITICAL assertions
|
||||
// and can contribute to SIGSEGV crashes. Guard with try-catch.
|
||||
mainWindowClose() async {
|
||||
try {
|
||||
await windowManager.hide();
|
||||
} catch (e) {
|
||||
debugPrint('Failed to hide window (may already be closing): $e');
|
||||
}
|
||||
};
|
||||
notMainWindowClose(WindowController windowController) async {
|
||||
if (controller.length != 0) {
|
||||
debugPrint("close not empty multiwindow from taskbar");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue