mail_op, MODEST_MAIL_OPERATION_QUEUE_OPERATION_REMOVED);
/* Free object */
+ modest_runtime_verify_object_last_ref (mail_op, "");
g_object_unref (G_OBJECT (mail_op));
- modest_runtime_verify_object_death (mail_op, "");
}
return TRUE; /* uninit maybe called if runtime_init failed */
g_return_val_if_fail (MODEST_IS_SINGLETONS(_singletons), FALSE);
+ modest_runtime_verify_object_last_ref(_singletons,"");
g_object_unref(G_OBJECT(_singletons));
- modest_runtime_verify_object_death(_singletons,"");
_singletons = NULL;
return TRUE;
ModestWindowMgr* modest_runtime_get_window_mgr (void);
/**
- * modest_runtime_verify_object_death
+ * modest_runtime_verify_object_last_ref
* @OBJ: some (GObject) ptr
* @NAME: name of @OBJ
*
- * macro to check whether @obj is 'dead', ie, it is no longer a valid GObject. If
+ * macro to check whether @obj holds only one more ref (ie. after the
+ * next unref it will die)
+ *
* not, a g_warning will be issued on stderr. NOTE: this is only active
* when MODEST_DEBUG contains "debug-objects".
*
***/
-#define modest_runtime_verify_object_death(OBJ,name) \
- do { \
- if (modest_runtime_get_debug_flags() & MODEST_RUNTIME_DEBUG_DEBUG_OBJECTS) \
- if (G_IS_OBJECT(OBJ)) \
- g_warning ("%s:%d: %s (" \
- #OBJ ") still holds a ref count of %d", \
- __FILE__,__LINE__,name, G_OBJECT(OBJ)->ref_count); \
+#define modest_runtime_verify_object_last_ref(OBJ,name) \
+ do { \
+ if (modest_runtime_get_debug_flags() & MODEST_RUNTIME_DEBUG_DEBUG_OBJECTS) \
+ if (G_IS_OBJECT(OBJ) && G_OBJECT(OBJ)->ref_count != 1) \
+ g_warning ("%s:%d: %s (" \
+ #OBJ ") still holds a ref count of %d", \
+ __FILE__,__LINE__,name, G_OBJECT(OBJ)->ref_count); \
} while (0)
priv = MODEST_SINGLETONS_GET_PRIVATE(obj);
if (priv->account_store) {
+ modest_runtime_verify_object_last_ref(priv->account_store,"");
g_object_unref (G_OBJECT(priv->account_store));
- modest_runtime_verify_object_death(priv->account_store,"");
priv->account_store = NULL;
}
if (priv->account_mgr) {
+ modest_runtime_verify_object_last_ref(priv->account_mgr,"");
g_object_unref (G_OBJECT(priv->account_mgr));
- modest_runtime_verify_object_death(priv->account_mgr,"");
priv->account_mgr = NULL;
}
if (priv->conf) {
+ modest_runtime_verify_object_last_ref(priv->conf,"");
g_object_unref (G_OBJECT(priv->conf));
- modest_runtime_verify_object_death(priv->conf,"");
priv->conf = NULL;
}
if (priv->cache_mgr) {
+ modest_runtime_verify_object_last_ref(priv->cache_mgr,"");
g_object_unref (G_OBJECT(priv->cache_mgr));
- modest_runtime_verify_object_death(priv->cache_mgr,"");
priv->cache_mgr = NULL;
}
if (priv->device) {
+ modest_runtime_verify_object_last_ref(priv->device,"");
g_object_unref (G_OBJECT(priv->device));
- modest_runtime_verify_object_death(priv->device,"");
priv->device = NULL;
}
if (priv->platform_fact) {
+ modest_runtime_verify_object_last_ref(priv->platform_fact,"");
g_object_unref (G_OBJECT(priv->platform_fact));
- modest_runtime_verify_object_death(priv->platform_fact,"");
priv->platform_fact = NULL;
}
if (priv->mail_op_queue) {
+ modest_runtime_verify_object_last_ref(priv->mail_op_queue,"");
g_object_unref (G_OBJECT(priv->mail_op_queue));
- modest_runtime_verify_object_death(priv->mail_op_queue,"");
priv->mail_op_queue = NULL;
}
if (priv->window_mgr) {
+ modest_runtime_verify_object_last_ref(priv->window_mgr,"");
g_object_unref (G_OBJECT(priv->window_mgr));
- modest_runtime_verify_object_death(priv->window_mgr,"");
priv->window_mgr = NULL;
}
GSList *cursor = accounts;
while (cursor) {
- /* TODO: This uses cursor->data after causing it to be freed,
- * as valgrind shows.
- * It's not clear what is being attempted here. murrayc */
- g_object_unref (G_OBJECT(cursor->data));
if (G_IS_OBJECT(cursor->data)) { /* check twice... */
const gchar *id = tny_account_get_id(TNY_ACCOUNT(cursor->data));
- modest_runtime_verify_object_death(cursor->data,id);
+ modest_runtime_verify_object_last_ref(cursor->data,id);
}
+ g_object_unref (G_OBJECT(cursor->data));
cursor = cursor->next;
}
g_slist_free (accounts);
if (priv->session) {
camel_object_unref (CAMEL_OBJECT(priv->session));
- modest_runtime_verify_object_death(priv->session, "");
priv->session = NULL;
}
/* Set new model */
gtk_tree_view_set_model (header_view, model);
-
- modest_runtime_verify_object_death (old_model, "");
- modest_runtime_verify_object_death (old_model_sort, "");
} else
gtk_tree_view_set_model (header_view, model);