spicec-x11: If the clipboard was large return the memory to the system

This commit is contained in:
Hans de Goede 2010-10-04 12:15:45 +02:00
parent ff434c288f
commit ca3d290294

View File

@ -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);
}