1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
From 97c2af8ccc913b0850ed4a54ed6c477cfbd7b475 Mon Sep 17 00:00:00 2001
From: Jean-Louis Dupond <jean-louis@dupond.be>
Date: Tue, 1 May 2012 17:37:21 +0200
Subject: [PATCH] clipboard bugfix + cleanup of memory
---
remmina-plugins/rdp/rdp_cliprdr.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/remmina-plugins/rdp/rdp_cliprdr.c b/remmina-plugins/rdp/rdp_cliprdr.c
index 0821ffa..b9b37ad 100644
--- a/remmina-plugins/rdp/rdp_cliprdr.c
+++ b/remmina-plugins/rdp/rdp_cliprdr.c
@@ -225,7 +225,7 @@ uint8* remmina_rdp_cliprdr_get_data(RemminaProtocolWidget* gp, uint32 format, in
if (format == CB_FORMAT_TEXT || format == CB_FORMAT_HTML || format == CB_FORMAT_UNICODETEXT)
{
- lf2crlf(inbuf, size);
+ inbuf = lf2crlf(inbuf, size);
if (format == CB_FORMAT_TEXT)
{
outbuf = inbuf;
@@ -269,6 +269,11 @@ uint8* remmina_rdp_cliprdr_get_data(RemminaProtocolWidget* gp, uint32 format, in
memcpy(outbuf, data + 14, *size);
}
}
+
+ if (inbuf)
+ g_free(inbuf);
+ if (G_IS_OBJECT(image))
+ g_object_unref(image);
if (!outbuf)
outbuf = (uint8*)"";
@@ -288,7 +293,7 @@ void remmina_rdp_cliprdr_parse_response_event(RemminaProtocolWidget* gp, RDP_EVE
gboolean img = FALSE;
rfContext* rfi = GET_DATA(gp);
RDP_CB_DATA_RESPONSE_EVENT* data_response_event;
-
+ GdkPixbufLoader *pixbuf;
data_response_event = (RDP_CB_DATA_RESPONSE_EVENT*) event;
data = data_response_event->data;
size = data_response_event->size;
@@ -341,7 +346,6 @@ void remmina_rdp_cliprdr_parse_response_event(RemminaProtocolWidget* gp, RDP_EVE
stream_detach(s);
stream_free(s);
}
- GdkPixbufLoader *pixbuf;
pixbuf = gdk_pixbuf_loader_new();
gdk_pixbuf_loader_write(pixbuf, data, size, NULL);
image = gdk_pixbuf_loader_get_pixbuf(pixbuf);
@@ -355,9 +359,17 @@ void remmina_rdp_cliprdr_parse_response_event(RemminaProtocolWidget* gp, RDP_EVE
if (text || img)
rfi->clipboard_wait = TRUE;
if (text)
- gtk_clipboard_set_text(clipboard, (gchar*)data, size);
+ {
+ gtk_clipboard_set_text(clipboard, (gchar*)data, size);
+ gtk_clipboard_store(clipboard);
+ }
if (img)
+ {
gtk_clipboard_set_image(clipboard, image);
+ gtk_clipboard_store(clipboard);
+ gdk_pixbuf_loader_close(pixbuf, NULL);
+ g_object_unref(pixbuf);
+ }
}
THREADS_LEAVE
--
1.7.10
|