corentin-soriano commented on code in PR #590:
URL: https://github.com/apache/guacamole-server/pull/590#discussion_r2086457372


##########
src/protocols/rdp/gdi.c:
##########
@@ -127,57 +115,33 @@ BOOL guac_rdp_gdi_end_paint(rdpContext* context) {
      * checking and bailing out here if an external bug breaks that. */
     GUAC_ASSERT(w <= INT_MAX && h <= INT_MAX);
 
+    guac_display_layer* default_layer = 
guac_display_default_layer(rdp_client->display);
+    guac_display_layer_raw_context* current_context = 
guac_display_layer_open_raw(default_layer);
+
+    /* Resynchronize default layer buffer details with FreeRDP's GDI */
+    guac_display_layer_resize(default_layer, gdi->width, gdi->height);
+
     /* Mark modified region as dirty, but only within the bounds of the
      * rendering surface */
     guac_rect dst_rect;
     guac_rect_init(&dst_rect, x, y, w, h);
     guac_rect_constrain(&dst_rect, &current_context->bounds);
     guac_rect_extend(&current_context->dirty, &dst_rect);
 
-    guac_display_render_thread_notify_modified(rdp_client->render_thread);
+    guac_display_layer_raw_context_put(current_context, &dst_rect,
+            GUAC_RECT_CONST_BUFFER(dst_rect, gdi->primary_buffer, gdi->stride, 
4),
+            gdi->stride);

Review Comment:
   I encounter a segfault here when resizing the screen (freerdp 3.9.0):
   ```
   May 13 10:11:18 localhost server[811467]: 10:11:18.262 
[http-nio-8080-exec-13] DEBUG o.a.g.net.InetGuacamoleSocket - Connecting to 
guacd at localhost:4822.
   May 13 10:11:18 localhost guacd[2411413]: Creating new client for protocol 
"rdp"
   May 13 10:11:18 localhost guacd[2411413]: Connection ID is 
"$43ee22fc-7ad6-44ba-b396-77da999ae552"
   May 13 10:11:18 localhost server[811467]: 10:11:18.506 
[http-nio-8080-exec-13] INFO  o.a.g.tunnel.TunnelRequestService - User 
"csoriano" connected to connection "AAA - win01".
   May 13 10:11:18 localhost server[811467]: 10:11:18.506 
[http-nio-8080-exec-13] DEBUG o.a.g.event.EventLoggingListener - Ignoring 
unknown/unimplemented event type: class 
org.apache.guacamole.net.event.TunnelConnectEvent
   May 13 10:11:18 localhost guacd[2413410]: Security mode: NLA
   May 13 10:11:18 localhost guacd[2413410]: Parameter "enable-sftp" must be 
either "true" or "false". Using default value.
   May 13 10:11:18 localhost guacd[2413410]: Resize method: display-update
   May 13 10:11:18 localhost guacd[2413410]: No clipboard line-ending 
normalization specified. Defaulting to preserving the format of all line 
endings.
   May 13 10:11:18 localhost guacd[2413410]: User 
"@d2a408b2-8170-4ca2-9ee7-09a4779b4515" joined connection 
"$43ee22fc-7ad6-44ba-b396-77da999ae552" (1 users now present)
   May 13 10:11:18 localhost guacd[2413410]: Local system reports 8 
processor(s) are available.
   May 13 10:11:18 localhost guacd[2413410]: Graphical updates will be encoded 
using 8 worker thread(s).
   May 13 10:11:18 localhost guacd[2413410]: Loading keymap "base"
   May 13 10:11:18 localhost guacd[2413410]: Loading keymap "base_altgr"
   May 13 10:11:18 localhost guacd[2413410]: Loading keymap "fr-fr-azerty"
   May 13 10:11:18 localhost server[811467]: 10:11:18.534 
[http-nio-8080-exec-10] DEBUG o.a.g.rest.RESTExceptionMapper - Client request 
rejected: No readable active connection for tunnel.
   May 13 10:11:19 localhost guacd[2413410]: Connected to RDPDR 1.13 as client 
0x0004
   May 13 10:11:22 localhost guacd[2413410]: Connected to RDPDR 1.13 as client 
0x0002
   May 13 10:11:22 localhost guacd[2413410]: RDPDR user logged on
   May 13 10:11:29 localhost kernel: guacd[2416139]: segfault at 7fca98121020 
ip 00007fcab6c55977 sp 00007fca9e6f49f8 error 6 in 
libc.so.6[7fcab6b24000+175000]
   May 13 10:11:29 localhost kernel: Code: 48 ff c7 48 01 fe 48 8d 54 11 80 0f 
1f 84 00 00 00 00 00 c5 fe 6f 0e c5 fe 6f 56 20 c5 fe 6f 5e 40 c5 fe 6f 66 60 
48 83 ee 80 <c5> fd 7f 0f c5 fd 7f 57 20 c5 fd 7f 5f 40 c5 fd 7f 67 60 48 83 ef
   May 13 10:11:29 localhost kernel: potentially unexpected fatal signal 11.
   May 13 10:11:29 localhost kernel: CPU: 0 PID: 2416139 Comm: guacd Not 
tainted 5.15.167.4-microsoft-standard-WSL2 #1
   May 13 10:11:29 localhost kernel: RIP: 0033:0x7fcab6c55977
   May 13 10:11:29 localhost kernel: Code: 48 ff c7 48 01 fe 48 8d 54 11 80 0f 
1f 84 00 00 00 00 00 c5 fe 6f 0e c5 fe 6f 56 20 c5 fe 6f 5e 40 c5 fe 6f 66 60 
48 83 ee 80 <c5> fd 7f 0f c5 fd 7f 57 20 c5 fd 7f 5f 40 c5 fd 7f 67 60 48 83 ef
   May 13 10:11:29 localhost kernel: RSP: 002b:00007fca9e6f49f8 EFLAGS: 00010207
   May 13 10:11:29 localhost kernel: RAX: 00007fca98121010 RBX: 
00007fca98122610 RCX: 00007fca98121010
   May 13 10:11:29 localhost kernel: RDX: 00007fca981224c0 RSI: 
00007fca8159c330 RDI: 00007fca98121020
   May 13 10:11:29 localhost kernel: RBP: 00007fca9e6f4aa0 R08: 
0000000000000000 R09: 00007fca9e6f4a30
   May 13 10:11:29 localhost kernel: R10: 00007fca9e6f49e8 R11: 
0000000000000000 R12: 00007fca8159c2a0
   May 13 10:11:29 localhost kernel: R13: 0000000000001600 R14: 
0000000000000000 R15: 0000000000001530
   May 13 10:11:29 localhost kernel: FS:  00007fca9e6f5640 GS:  0000000000000000
   May 13 10:11:29 localhost systemd-coredump: Failed to connect to coredump 
service: No such file or directory
   May 13 10:11:29 localhost guacd[2411413]: Connection 
"$43ee22fc-7ad6-44ba-b396-77da999ae552" removed.
   May 13 10:11:33 localhost server[811467]: 10:11:33.168 [Thread-28] DEBUG 
o.a.g.event.EventLoggingListener - Ignoring unknown/unimplemented event type: 
class org.apache.guacamole.net.event.TunnelCloseEvent
   May 13 10:11:33 localhost server[811467]: 10:11:33.168 [Thread-28] INFO  
o.a.g.tunnel.TunnelRequestService - User "csoriano" disconnected from 
connection "AAA - win01". Duration: 14662 milliseconds
   May 13 10:11:33 localhost server[811467]: 10:11:33.168 [Thread-28] DEBUG 
o.a.g.net.InetGuacamoleSocket - Closing socket to guacd.
   May 13 10:11:33 localhost server[811467]: 10:11:33.182 
[http-nio-8080-exec-13] DEBUG o.a.g.event.EventLoggingListener - User 
"csoriano" (authenticated by "default") successfully re-authenticated their 
existing session from 127.0.0.1
   ```
   No relevant logs in guacd in debug mode.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to