[Spice-devel] [PATCH spice 17/17] spicec-x11: If the clipboard was large return the memory to the system
Arnon Gilboa
agilboa at redhat.com
Mon Oct 4 10:43:37 PDT 2010
Hans de Goede wrote:
> ---
> client/x11/platform.cpp | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
> index 836561e..28530ea 100644
> --- a/client/x11/platform.cpp
> +++ b/client/x11/platform.cpp
> @@ -2445,7 +2445,14 @@ exit:
>
> static void get_selection_free(unsigned char *data, bool incr)
> {
> - if (!incr && data)
> + if (incr) {
> + /* If the clipboard was large return the memory to the system */
> + if (clipboard_data_space > 512 * 1024) {
> + free(clipboard_data);
> + clipboard_data = NULL;
> + clipboard_data_space = 0;
> + }
> + } else if (data)
> XFree(data);
> }
>
>
#define may be nice here
Ack
More information about the Spice-devel
mailing list