[Goodies-dev] [Goodies-commits] r1753 - in verve-plugin/trunk: . panel-plugin

Benedikt Meurer benedikt.meurer at unix-ag.uni-siegen.de
Wed Jul 12 16:04:49 CEST 2006


Jannis Pohlmann wrote:
>>>Modified: verve-plugin/trunk/panel-plugin/verve-plugin.c
>>>===================================================================
>>>--- verve-plugin/trunk/panel-plugin/verve-plugin.c
>>>2006-07-11 14:37:30 UTC (rev 1752) +++
>>>verve-plugin/trunk/panel-plugin/verve-plugin.c	2006-07-11
>>>15:17:52 UTC (rev 1753) @@ -79,10 +79,10 @@ void
>>> verve_plugin_load_completion (VerveEnv* env, gpointer user_data)
>>> {
>>>+  gdk_threads_enter ();
>>>+
>>>   VervePlugin *verve = (VervePlugin*) user_data;
>>> 
>>>-  g_debug ("Receiving load-binaries signal\n");
>>>-
>>>   verve->completion = g_completion_new (NULL);
>>> 
>>>   /* Load command history */
>>>@@ -91,6 +91,8 @@
>>>   /* Load linux binaries from PATH */
>>>   GList *binaries = verve_env_get_path_binaries (env);
>>> 
>>>+  g_debug ("Receiving load-binaries signal\n");
>>>+
>>>   /* Add command history to completion */
>>>   if (G_LIKELY (history != NULL)) 
>>>     g_completion_add_items (verve->completion, history);
>>>@@ -98,6 +100,8 @@
>>>   /* Add binaries to completion list */
>>>   if (G_LIKELY (binaries != NULL))
>>>     g_completion_add_items (verve->completion, binaries);
>>>+
>>>+  gdk_threads_leave ();
>>> }
>>
>>Err, no, that doesn't change anything. Please read the GDK threads
>>documentation.
> 
> In your code (thunar-vfs-job.c) I fond a GDK_THREADS_ENTER/LEAVE around
> the signal_emit call. Would something like this work?
> 
> Inside of the thread:
> 
>     gdk_threads_enter ();
> 
>     /* Emit 'load-binaries' signal */
>     g_signal_emit_by_name (env, "load-binaries");
> 
>     gdk_threads_leave ();

Nope. Forget about the global GDK lock, it's very difficult to use, esp.
since the main loop in GLib runs outside the GDK lock.

Just define a static mutex, using

 G_LOCK_DEFINE_STATIC(your_lock);

and add

 G_LOCK(your_lock);
 ...
 G_UNLOCK(your_lock);

to protect the access to your completion.


> - Jannis

Benedikt



More information about the Goodies-dev mailing list