All pastes #33980 Raw Edit

Stuff

public text v1 · immutable
#33980 ·published 2005-12-17 18:30 UTC
rendered paste body
Index: libgdict/gdict-client-context.c
===================================================================
RCS file: /cvs/gnome/gnome-utils/gnome-dictionary/libgdict/gdict-client-context.c,v
retrieving revision 1.2
diff -u -p -r1.2 gdict-client-context.c
--- libgdict/gdict-client-context.c	16 Dec 2005 17:32:29 -0000	1.2
+++ libgdict/gdict-client-context.c	17 Dec 2005 18:27:15 -0000
@@ -890,6 +890,20 @@ gdict_client_context_real_connected (Gdi
   gdict_client_context_run_command (context, cmd, NULL);
 }
 
+static void
+clear_command_queue (GdictClientContext *context)
+{
+  GdictClientContextPrivate *priv = context->priv;
+
+  g_queue_foreach (priv->commands_queue,
+                   (GFunc) gdict_command_free,
+                   NULL);
+  g_queue_free (priv->commands_queue);
+
+  /* renew */
+  priv->commands_queue = g_queue_new ();
+}
+
 /* force a disconnection from the server */
 static void
 gdict_client_context_force_disconnect (GdictClientContext *context)
@@ -910,10 +924,7 @@ gdict_client_context_force_disconnect (G
       priv->channel = NULL;
     }
 
-  /* clear the commands queue */
-  g_queue_foreach (priv->commands_queue,
-                   (GFunc) gdict_command_free,
-                   NULL);
+  clear_command_queue (context);
 }
 
 static void