* Fix some detected memory leaks
[modest] / src / modest-mail-operation-queue.c
index 6f46a4e..5ae5707 100644 (file)
@@ -202,16 +202,26 @@ modest_mail_operation_queue_remove (ModestMailOperationQueue *self,
        g_signal_emit (self, signals[QUEUE_CHANGED_SIGNAL], 0,
                       mail_op, MODEST_MAIL_OPERATION_QUEUE_OPERATION_REMOVED);
 
-       /* TODO: errors? */
-       {
-               const GError *err = modest_mail_operation_get_error (mail_op);
-               if (err)
-                       g_warning (err->message);
-       }
-
        /* Free object */
+       modest_runtime_verify_object_last_ref (mail_op, "");
        g_object_unref (G_OBJECT (mail_op));
-       modest_runtime_verify_object_death (mail_op, "");
+}
+
+guint 
+modest_mail_operation_queue_num_elements (ModestMailOperationQueue *self)
+{
+       ModestMailOperationQueuePrivate *priv;
+       guint length = 0;
+
+       g_return_val_if_fail (MODEST_IS_MAIL_OPERATION_QUEUE (self), 0);
+       
+       priv = MODEST_MAIL_OPERATION_QUEUE_GET_PRIVATE(self);
+
+       g_mutex_lock (priv->queue_lock);
+       length = g_queue_get_length (priv->op_queue);
+       g_mutex_unlock (priv->queue_lock);
+
+       return length;
 }