From ca3d29029455cbb3441a5a7715f43638f3d54d1c Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 4 Oct 2010 12:15:45 +0200 Subject: spicec-x11: If the clipboard was large return the memory to the system --- client/x11/platform.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'client/x11') diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index dc0787f0..c6b2d7de 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); } -- cgit