Commit 27b45d3a 27b45d3a558b2a62d594458458aa7b0a041a15d4 by Alain Magloire

add reference count for floating message.

1 parent 203c6eb3
......@@ -63,7 +63,8 @@ message_destroy (message_t *pmsg, void *owner)
message_t msg = *pmsg;
msg->ref--;
if (msg->owner == owner)
if ((msg->owner && msg->owner == owner)
|| (msg->owner == NULL && msg->ref <= 0))
{
/* Notify the listeners. */
/* FIXME: to be removed since we do not supoort this event. */
......@@ -93,6 +94,9 @@ message_destroy (message_t *pmsg, void *owner)
if (msg->mime)
mime_destroy (&(msg->mime));
/* Loose the owner. */
msg->owner = NULL;
if (msg->ref <= 0)
free (msg);
}
......