Skip to content

Commit

Permalink
gfx: fix for sorted caps
Browse files Browse the repository at this point in the history
  • Loading branch information
jsorg71 committed Sep 22, 2023
1 parent a2d0336 commit 404e29f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions xrdp/xrdp_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,7 @@ xrdp_mm_egfx_caps_advertise(void *user, int caps_count,
{
LOG(LOG_LEVEL_INFO, "xrdp_mm_egfx_caps_advertise: can not do gfx");
}
/* create copy for sorting */
ver_flags = g_new(struct _ver_flags, caps_count);
if (ver_flags == NULL)
{
Expand All @@ -1201,6 +1202,7 @@ xrdp_mm_egfx_caps_advertise(void *user, int caps_count,
ver_flags[index].version = versions[index];
ver_flags[index].flags = flagss[index];
}
/* sort */
g_qsort(ver_flags, caps_count, sizeof(struct _ver_flags), cmpverfunc);
best_index = -1;
best_h264_index = -1;
Expand Down Expand Up @@ -1253,7 +1255,6 @@ xrdp_mm_egfx_caps_advertise(void *user, int caps_count,
break;
}
}
g_free(ver_flags);
if (best_pro_index >= 0)
{
best_index = best_pro_index;
Expand All @@ -1269,10 +1270,10 @@ xrdp_mm_egfx_caps_advertise(void *user, int caps_count,
if (best_index >= 0)
{
LOG(LOG_LEVEL_INFO, " replying version 0x%8.8x flags 0x%8.8x",
versions[best_index], flagss[best_index]);
ver_flags[best_index].version, ver_flags[best_index].flags);
error = xrdp_egfx_send_capsconfirm(self->egfx,
versions[best_index],
flagss[best_index]);
ver_flags[best_index].version,
ver_flags[best_index].flags);
LOG(LOG_LEVEL_INFO, "xrdp_mm_egfx_caps_advertise: xrdp_egfx_send_capsconfirm "
"error %d", error);
error = xrdp_egfx_send_reset_graphics(self->egfx,
Expand Down Expand Up @@ -1316,6 +1317,7 @@ xrdp_mm_egfx_caps_advertise(void *user, int caps_count,
self->encoder = xrdp_encoder_create(self);
xrdp_bitmap_invalidate(screen, &lrect);
}
g_free(ver_flags);
return 0;
}

Expand Down

0 comments on commit 404e29f

Please sign in to comment.