File gtk-vnc-unref-gsource.patch of Package gtk-vnc
From 968968c9cf705f5bc96764399ea17a27a454c1c5 Mon Sep 17 00:00:00 2001
From: Daniel P. Berrange <berrange@redhat.com>
Date: Tue, 14 Dec 2010 12:41:01 +0000
Subject: Fix leak of GSource objects which causes performance problems
The GLib event loop scales poorly as the number of GSource objects
increases. A missing unref on the GSource objects used in the VNC
connection meant that many unused instances accumulated, slowing
down the event loop processing.
* src/vncconnection.c: Unref all GSource objects
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 165a5f1..51b8b8d 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -234,6 +234,7 @@ static GIOCondition g_io_wait(GSocket *sock, GIOCondition cond)
g_source_set_callback(src, (GSourceFunc)g_io_wait_helper, coroutine_self(), NULL);
g_source_attach(src, NULL);
ret = coroutine_yield(NULL);
+ g_source_unref(src);
return *ret;
}
@@ -254,6 +255,7 @@ static GIOCondition g_io_wait_interruptable(struct wait_queue *wait,
id = g_source_attach(src, NULL);
wait->waiting = TRUE;
ret = coroutine_yield(NULL);
+ g_source_unref(src);
wait->waiting = FALSE;
if (ret == NULL) {
@@ -334,6 +336,8 @@ static gboolean g_condition_wait(g_condition_wait_func func, gpointer data)
g_source_attach(src, NULL);
g_source_set_callback(src, g_condition_wait_helper, coroutine_self(), NULL);
coroutine_yield(NULL);
+ g_source_unref(src);
+
return TRUE;
}
--
cgit v0.8.3.1