mirror of
https://github.com/sol1/rustguac.git
synced 2026-09-10 01:26:06 +00:00
Fix patches for upstream guacamole-server HEAD
Patches 003 and 004 regenerated against current upstream: - 003: upstream already added config.h to disp.c and input.c, removed those hunks. NULL guards and remaining config.h additions preserved. - 004: upstream added path_lock field to display layer, adjusted context.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
diff --git a/src/protocols/rdp/channels/common-svc.c b/src/protocols/rdp/channels/common-svc.c
|
||||
index 774316f4..d4e70243 100644
|
||||
index 774316f..d4e7024 100644
|
||||
--- a/src/protocols/rdp/channels/common-svc.c
|
||||
+++ b/src/protocols/rdp/channels/common-svc.c
|
||||
@@ -17,6 +17,7 @@
|
||||
@@ -11,30 +11,22 @@ index 774316f4..d4e70243 100644
|
||||
#include "plugins/channels.h"
|
||||
#include "rdp.h"
|
||||
diff --git a/src/protocols/rdp/channels/disp.c b/src/protocols/rdp/channels/disp.c
|
||||
index 0293843c..616b77d7 100644
|
||||
index 7a0e188..3e2b318 100644
|
||||
--- a/src/protocols/rdp/channels/disp.c
|
||||
+++ b/src/protocols/rdp/channels/disp.c
|
||||
@@ -17,6 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
+#include "config.h"
|
||||
#include "channels/disp.h"
|
||||
#include "plugins/channels.h"
|
||||
#include "fs.h"
|
||||
@@ -161,6 +162,10 @@ void guac_rdp_disp_load_plugin(rdpContext* context) {
|
||||
@@ -163,6 +163,10 @@ void guac_rdp_disp_load_plugin(rdpContext* context) {
|
||||
void guac_rdp_disp_set_size(guac_rdp_disp* disp, guac_rdp_settings* settings,
|
||||
freerdp* rdp_inst, int width, int height) {
|
||||
|
||||
+ /* Abort if display module or settings are not yet initialized */
|
||||
+ if (disp == NULL || settings == NULL)
|
||||
+ /* Guard against NULL disp — can be called before channel is initialized */
|
||||
+ if (disp == NULL)
|
||||
+ return;
|
||||
+
|
||||
guac_rect resize = {
|
||||
.left = 0,
|
||||
.top = 0,
|
||||
diff --git a/src/protocols/rdp/channels/pipe-svc.c b/src/protocols/rdp/channels/pipe-svc.c
|
||||
index 68d43488..4a5a3e9e 100644
|
||||
index 68d4348..4a5a3e9 100644
|
||||
--- a/src/protocols/rdp/channels/pipe-svc.c
|
||||
+++ b/src/protocols/rdp/channels/pipe-svc.c
|
||||
@@ -17,6 +17,7 @@
|
||||
@@ -46,7 +38,7 @@ index 68d43488..4a5a3e9e 100644
|
||||
#include "channels/pipe-svc.h"
|
||||
#include "common/list.h"
|
||||
diff --git a/src/protocols/rdp/channels/rdpei.c b/src/protocols/rdp/channels/rdpei.c
|
||||
index a94faa9f..317e39dd 100644
|
||||
index a94faa9..317e39d 100644
|
||||
--- a/src/protocols/rdp/channels/rdpei.c
|
||||
+++ b/src/protocols/rdp/channels/rdpei.c
|
||||
@@ -17,6 +17,7 @@
|
||||
@@ -58,7 +50,7 @@ index a94faa9f..317e39dd 100644
|
||||
#include "plugins/channels.h"
|
||||
#include "rdp.h"
|
||||
diff --git a/src/protocols/rdp/channels/rdpgfx.c b/src/protocols/rdp/channels/rdpgfx.c
|
||||
index 0fae972f..327e7c2b 100644
|
||||
index 0fae972..327e7c2 100644
|
||||
--- a/src/protocols/rdp/channels/rdpgfx.c
|
||||
+++ b/src/protocols/rdp/channels/rdpgfx.c
|
||||
@@ -17,6 +17,7 @@
|
||||
@@ -70,26 +62,18 @@ index 0fae972f..327e7c2b 100644
|
||||
#include "plugins/channels.h"
|
||||
#include "rdp.h"
|
||||
diff --git a/src/protocols/rdp/input.c b/src/protocols/rdp/input.c
|
||||
index 34f9e7c4..5d4d5edf 100644
|
||||
index 63c0be2..c0d955e 100644
|
||||
--- a/src/protocols/rdp/input.c
|
||||
+++ b/src/protocols/rdp/input.c
|
||||
@@ -17,6 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
@@ -105,6 +105,11 @@ int guac_rdp_user_size_handler(guac_user* user, int width, int height) {
|
||||
|
||||
+#include "config.h"
|
||||
#include "channels/disp.h"
|
||||
#include "channels/rdpei.h"
|
||||
#include "input.h"
|
||||
@@ -106,6 +107,11 @@ int guac_rdp_user_size_handler(guac_user* user, int width, int height) {
|
||||
guac_client* client = user->client;
|
||||
guac_rdp_client* rdp_client = (guac_rdp_client*) client->data;
|
||||
+
|
||||
+ /* Guard against early size messages before RDP is fully connected */
|
||||
+ if (rdp_client == NULL || rdp_client->settings == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
guac_rdp_settings* settings = rdp_client->settings;
|
||||
freerdp* rdp_inst = rdp_client->rdp_inst;
|
||||
|
||||
+ /* Abort if not yet fully initialized (browser may send size instruction
|
||||
+ * before the RDP connection is fully established) */
|
||||
+ if (settings == NULL || rdp_client->disp == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
/* Convert client pixels to remote pixels */
|
||||
width = width * settings->resolution / user->info.optimal_resolution;
|
||||
height = height * settings->resolution / user->info.optimal_resolution;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
diff --git a/src/libguac/display-layer-list.c b/src/libguac/display-layer-list.c
|
||||
index f80aa3a4..3b891107 100644
|
||||
index b876d25..a20028c 100644
|
||||
--- a/src/libguac/display-layer-list.c
|
||||
+++ b/src/libguac/display-layer-list.c
|
||||
@@ -363,6 +363,14 @@ void guac_display_remove_layer(guac_display_layer* display_layer) {
|
||||
|
||||
@@ -366,6 +366,15 @@ void guac_display_remove_layer(guac_display_layer* display_layer) {
|
||||
guac_mem_free(display_layer->last_frame.buffer);
|
||||
guac_mem_free(display_layer->pending_frame_cells);
|
||||
|
||||
+ /* Free any queued H.264 frames */
|
||||
+ struct guac_h264_frame* h264_frame = display_layer->h264_queue;
|
||||
+ while (h264_frame != NULL) {
|
||||
@@ -14,11 +14,12 @@ index f80aa3a4..3b891107 100644
|
||||
+ guac_mem_free(h264_frame);
|
||||
+ h264_frame = next;
|
||||
+ }
|
||||
+
|
||||
pthread_mutex_destroy(&display_layer->path_lock);
|
||||
|
||||
guac_mem_free(display_layer);
|
||||
|
||||
diff --git a/src/libguac/display-layer.c b/src/libguac/display-layer.c
|
||||
index 2c983a15..410e42ac 100644
|
||||
index 2c983a1..410e42a 100644
|
||||
--- a/src/libguac/display-layer.c
|
||||
+++ b/src/libguac/display-layer.c
|
||||
@@ -20,6 +20,7 @@
|
||||
@@ -74,7 +75,7 @@ index 2c983a15..410e42ac 100644
|
||||
+
|
||||
+}
|
||||
diff --git a/src/libguac/display-plan.c b/src/libguac/display-plan.c
|
||||
index 6cd726bb..ff913da4 100644
|
||||
index 6cd726b..ff913da 100644
|
||||
--- a/src/libguac/display-plan.c
|
||||
+++ b/src/libguac/display-plan.c
|
||||
@@ -23,11 +23,15 @@
|
||||
@@ -279,7 +280,7 @@ index 6cd726bb..ff913da4 100644
|
||||
|
||||
case GUAC_DISPLAY_PLAN_OPERATION_COPY:
|
||||
diff --git a/src/libguac/display-priv.h b/src/libguac/display-priv.h
|
||||
index 255fb897..b80fd5fe 100644
|
||||
index d6082e1..d86cb95 100644
|
||||
--- a/src/libguac/display-priv.h
|
||||
+++ b/src/libguac/display-priv.h
|
||||
@@ -317,6 +317,19 @@ struct guac_display_render_thread {
|
||||
@@ -302,7 +303,7 @@ index 255fb897..b80fd5fe 100644
|
||||
/**
|
||||
* Approximation of how often a region of a layer is modified, as well as what
|
||||
* changes have been made to that region since the last frame. This information
|
||||
@@ -603,6 +616,37 @@ struct guac_display_layer {
|
||||
@@ -609,6 +622,37 @@ struct guac_display_layer {
|
||||
*/
|
||||
size_t pending_frame_cells_height;
|
||||
|
||||
@@ -341,7 +342,7 @@ index 255fb897..b80fd5fe 100644
|
||||
|
||||
typedef struct guac_display_state {
|
||||
diff --git a/src/libguac/guacamole/display.h b/src/libguac/guacamole/display.h
|
||||
index 9894042a..d1a990fe 100644
|
||||
index 9894042..d1a990f 100644
|
||||
--- a/src/libguac/guacamole/display.h
|
||||
+++ b/src/libguac/guacamole/display.h
|
||||
@@ -417,6 +417,43 @@ guac_display_layer* guac_display_alloc_buffer(guac_display* display, int opaque)
|
||||
@@ -389,7 +390,7 @@ index 9894042a..d1a990fe 100644
|
||||
* Returns a layer representing the current mouse cursor icon. Changes to the
|
||||
* contents of this layer will affect the remote mouse cursor after the current
|
||||
diff --git a/src/protocols/rdp/channels/rdpgfx.c b/src/protocols/rdp/channels/rdpgfx.c
|
||||
index 327e7c2b..55cd8cfe 100644
|
||||
index 327e7c2..55cd8cf 100644
|
||||
--- a/src/protocols/rdp/channels/rdpgfx.c
|
||||
+++ b/src/protocols/rdp/channels/rdpgfx.c
|
||||
@@ -24,14 +24,122 @@
|
||||
@@ -549,7 +550,7 @@ index 327e7c2b..55cd8cfe 100644
|
||||
}
|
||||
-
|
||||
diff --git a/src/protocols/rdp/rdp.h b/src/protocols/rdp/rdp.h
|
||||
index 065080a3..a0893ffb 100644
|
||||
index 065080a..a0893ff 100644
|
||||
--- a/src/protocols/rdp/rdp.h
|
||||
+++ b/src/protocols/rdp/rdp.h
|
||||
@@ -132,6 +132,13 @@ typedef struct guac_rdp_client {
|
||||
@@ -567,7 +568,7 @@ index 065080a3..a0893ffb 100644
|
||||
* Queue of mouse, keyboard, and touch events. These events are accumulated
|
||||
* and flushed within the RDP client thread to avoid spending excessive
|
||||
diff --git a/src/protocols/rdp/settings.c b/src/protocols/rdp/settings.c
|
||||
index d97d98e1..26648d09 100644
|
||||
index d97d98e..26648d0 100644
|
||||
--- a/src/protocols/rdp/settings.c
|
||||
+++ b/src/protocols/rdp/settings.c
|
||||
@@ -100,6 +100,7 @@ const char* GUAC_RDP_CLIENT_ARGS[] = {
|
||||
@@ -626,7 +627,7 @@ index d97d98e1..26648d09 100644
|
||||
if (rdp_settings->ColorDepth != RDP_GFX_REQUIRED_DEPTH) {
|
||||
guac_client_log(client, GUAC_LOG_WARNING, "Ignoring requested "
|
||||
diff --git a/src/protocols/rdp/settings.h b/src/protocols/rdp/settings.h
|
||||
index 87745cf5..e752b565 100644
|
||||
index 87745cf..e752b56 100644
|
||||
--- a/src/protocols/rdp/settings.h
|
||||
+++ b/src/protocols/rdp/settings.h
|
||||
@@ -652,6 +652,11 @@ typedef struct guac_rdp_settings {
|
||||
|
||||
Reference in New Issue
Block a user