Repository: rustdesk
Issue: Disconnection when closing windows
Labels: bug

### Bug Description

When connected to another Linux station, in this case Ubuntu 24.04, when closing any window using the X button, my connection to the host is terminated, and RustDesk needs to reconnect. This also occurs when clicking confirmation buttons; in short, each time a window is closed or a button is clicked, the RustDesk connection is reinitialized.

I am on a local network connecting by both ID and IP, and the error occurs with any type of connection.

**Local:**
OS = Ubuntu 24.04
Kernel = 6.8.0-39-generic
Display Server = X11

**Remote:**
Local:
OS = Ubuntu 24.04
Kernel = 6.8.0-39-generic
Display Server = X11

When I am connected to a Windows host, the problem does not occur.


### How to Reproduce

1. Connect from one Ubuntu Linux host to another Ubuntu Linux host.
2. Open any window and click the 'X' close button.
3. Or use the confirm buttons to save a file.
4. Rustdesk disconnects and reconnects.

### Expected Behavior

It is expected that the connection to the host will not be disconnected, and that a reconnection will not be performed every time.

### Operating system(s) on local side and remote side

Ubuntu 24.04 >  Ubuntu 24.04

### RustDesk Version(s) on local side and remote side

1.2.7

### Screenshots

![Peek 08-08-2024 14-54](https://github.com/user-attachments/assets/6e34e1ee-d22b-4eb2-9701-3acd0a2fbec0)


### Additional Context

Logs I collected from remote host
cat /var/log/syslog

```
2024-08-08T14:45:06.989104-04:00 m-ti02 rustdesk[990304]: message repeated 171 times: [ XGetWindowProperty[_NET_ACTIVE_WINDOW] failed (code=1)]
2024-08-08T14:45:07.025679-04:00 m-ti02 rustdesk[990304]: XGetWindowProperty[_NET_ACTIVE_WINDOW] failed (code=1)
2024-08-08T14:45:07.456199-04:00 m-ti02 rustdesk[990304]: message repeated 13 times: [ XGetWindowProperty[_NET_ACTIVE_WINDOW] failed (code=1)]
2024-08-08T14:45:14.978301-04:00 m-ti02 rustdesk[990304]: XGetWindowProperty[_NET_ACTIVE_WINDOW] failed (code=1)
2024-08-08T14:45:18.728003-04:00 m-ti02 rustdesk[990304]: message repeated 113 times: [ XGetWindowProperty[_NET_ACTIVE_WINDOW] failed (code=1)]
2024-08-08T14:45:18.758849-04:00 m-ti02 rustdesk[990304]: XGetWindowProperty[_NET_ACTIVE_WINDOW] failed (code=1)
2024-08-08T14:45:19.191062-04:00 m-ti02 rustdesk[990304]: message repeated 13 times: [ XGetWindowProperty[_NET_ACTIVE_WINDOW] failed (code=1)]
2024-08-08T14:45:21.383421-04:00 m-ti02 rustdesk[990304]: X Error of failed request: BadWindow (invalid Window parameter)
2024-08-08T14:45:21.383700-04:00 m-ti02 rustdesk[990304]: Major opcode of failed request: 3 (X_GetWindowAttributes)
2024-08-08T14:45:21.383814-04:00 m-ti02 rustdesk[990304]: Resource id in failed request: 0x5200007
2024-08-08T14:45:21.384125-04:00 m-ti02 rustdesk[990304]: Serial number of failed request: 10916
2024-08-08T14:45:21.384175-04:00 m-ti02 rustdesk[990304]: Current serial number in output stream: 10917
2024-08-08T14:45:21.451076-04:00 m-ti02 rustdesk[990697]: flutter: model closed
2024-08-08T14:45:21.456186-04:00 m-ti02 rustdesk[990697]: gtk_widget_set_opacity: assertion 'GTK_IS_WIDGET (widget)' failed
2024-08-08T14:45:21.456554-04:00 m-ti02 rustdesk[990697]: gtk_window_get_position: assertion 'GTK_IS_WINDOW (window)' failed
2024-08-08T14:45:21.456661-04:00 m-ti02 rustdesk[990697]: gtk_window_get_size: assertion 'GTK_IS_WINDOW (window)' failed
2024-08-08T14:45:21.456738-04:00 m-ti02 rustdesk[990697]: gtk_widget_hide: assertion 'GTK_IS_WIDGET (widget)' failed
2024-08-08T14:45:21.456825-04:00 m-ti02 rustdesk[990697]: gtk_window_move: assertion 'GTK_IS_WINDOW (window)' failed
2024-08-08T14:45:21.456915-04:00 m-ti02 rustdesk[990697]: gtk_window_resize: assertion 'GTK_IS_WINDOW (window)' failed
2024-08-08T14:45:22.413440-04:00 m-ti02 rustdesk[992243]: Cannot load libcuda.so.1
2024-08-08T14:45:22.438345-04:00 m-ti02 rustdesk[992243]: Cannot load libcuda.so.1
```

_No response_