Fixes some problems with monitor hotplug

This fixes some monitor hotplug issues with non-GFX codepaths.

1) The server_version_message() was working on an out-of-date
   copy of the client_info. As a result, the X server and the
   window manager did not agree on the number of windows
2) As a result of 1), a memory leak was found in the VNC module.
This commit is contained in:
matt335672 2024-02-08 15:51:30 +00:00 committed by Koichiro Iwao
parent 6272ae6018
commit e00236193f
3 changed files with 8 additions and 10 deletions

View File

@ -1153,15 +1153,6 @@ libxrdp_reset(struct xrdp_session *session,
return 0;
}
/* if same (and only one monitor on client) don't need to do anything */
if (client_info->display_sizes.session_width == width &&
client_info->display_sizes.session_height == height &&
client_info->bpp == bpp &&
(client_info->display_sizes.monitorCount == 0 || client_info->multimon == 0))
{
return 0;
}
client_info->display_sizes.session_width = width;
client_info->display_sizes.session_height = height;
client_info->display_sizes.monitorCount = 0;

View File

@ -2133,6 +2133,7 @@ lib_mod_set_param(struct vnc *v, const char *name, const char *value)
(const struct xrdp_client_info *) value;
g_free(v->client_layout.s);
v->client_layout.count = 0;
/* Save monitor information from the client */
if (!client_info->multimon || client_info->display_sizes.monitorCount < 1)

View File

@ -1743,6 +1743,13 @@ process_display_control_monitor_layout_data(struct xrdp_wm *wm)
mm, WMRZ_SERVER_VERSION_MESSAGE_START);
break;
case WMRZ_SERVER_VERSION_MESSAGE_START:
/* Update the client_info structure with the new description
* and tell the module so it can communicate the new
* screen layout to the backend */
sync_dynamic_monitor_data(wm, &(description->description));
module->mod_set_param(module, "client_info",
(const char *) (wm->session->client_info));
error = module->mod_server_version_message(module);
if (error != 0)
{
@ -1813,7 +1820,6 @@ process_display_control_monitor_layout_data(struct xrdp_wm *wm)
" xrdp_bitmap_resize failed %d", error);
return advance_error(error, mm);
}
sync_dynamic_monitor_data(wm, &(description->description));
advance_resize_state_machine(mm, WMRZ_EGFX_INITIALIZE);
break;
case WMRZ_EGFX_INITIALIZE: