[anjuta] libanjuta: Avoid a critical warning when an anjuta window is closed quite fast



commit bbda02af2e73392505ed5ec2132d122d89c2832c
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Thu Nov 8 21:30:06 2012 +0100

    libanjuta: Avoid a critical warning when an anjuta window is closed quite fast

 libanjuta/anjuta-status.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/libanjuta/anjuta-status.c b/libanjuta/anjuta-status.c
index a5ead1e..d0a266f 100644
--- a/libanjuta/anjuta-status.c
+++ b/libanjuta/anjuta-status.c
@@ -246,9 +246,13 @@ void
 anjuta_status_pop (AnjutaStatus *status)
 {
 	g_return_if_fail (ANJUTA_IS_STATUS (status));
-	
-	gtk_statusbar_pop (GTK_STATUSBAR (status->priv->status_bar),
-					   status->priv->push_message);
+
+	/* This can be called on a time out when the status object is destroyed */
+	if (status->priv->status_bar != NULL)
+	{
+		gtk_statusbar_pop (GTK_STATUSBAR (status->priv->status_bar),
+						   status->priv->push_message);
+	}
 
 	status->priv->push_values = g_list_remove_link (status->priv->push_values,
 													status->priv->push_values);
@@ -607,6 +611,8 @@ static gboolean
 anjuta_status_timeout (AnjutaStatus *status)
 {
 	anjuta_status_pop (status);
+	g_object_unref (status);
+
 	return FALSE;
 }
 
@@ -620,7 +626,7 @@ anjuta_status (AnjutaStatus *status, const gchar *mesg, gint timeout)
 	g_return_if_fail (ANJUTA_IS_STATUS (status));
 	g_return_if_fail (mesg != NULL);
 	anjuta_status_push (status, "%s", mesg);
-	g_timeout_add_seconds (timeout, (void*) anjuta_status_timeout, status);
+	g_timeout_add_seconds (timeout, (void*) anjuta_status_timeout, g_object_ref (status));
 }
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]