[Telepathy-commits] [telepathy-mission-control/master] Handle low-memory situations

Alberto Mardegan alberto.mardegan at nokia.com
Fri Feb 6 05:52:02 PST 2009


Prevent creation of outgoing channels in low-memory situations.
---
 src/mcd-account-requests.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mcd-account-requests.c b/src/mcd-account-requests.c
index e8ace26..ae40765 100644
--- a/src/mcd-account-requests.c
+++ b/src/mcd-account-requests.c
@@ -30,6 +30,7 @@
 #include <config.h>
 
 #include <dbus/dbus-glib-lowlevel.h>
+#include <libmcclient/mc-errors.h>
 #include <telepathy-glib/svc-generic.h>
 #include <telepathy-glib/gtypes.h>
 #include <telepathy-glib/util.h>
@@ -152,6 +153,13 @@ create_request (McdAccount *account, GHashTable *properties,
 
     g_return_val_if_fail (error != NULL, NULL);
 
+    if (mcd_mission_get_flags (MCD_MISSION (mcd_master_get_default ())) &
+        MCD_SYSTEM_MEMORY_CONSERVED)
+    {
+        g_set_error (error, MC_ERROR, MC_LOWMEM_ERROR, "Insufficient memory");
+        return NULL;
+    }
+
     /* We MUST deep-copy the hash-table, as we don't know how dbus-glib will
      * free it */
     props = _mcd_deepcopy_asv (properties);
-- 
1.5.6.5




More information about the telepathy-commits mailing list