Re: ANNOUNCE: Verve 0.1.0 - A panel command line plugin

Jasper Huijsmans <[email protected]> Sun, 12 Feb 2006 10:55:41 +0100
Newsgroups gmane.comp.desktop.xfce.goodies.devel
Message-ID <[email protected]>
Daichi Kawahata schreef:
> Hi Jannis, Jasper,
> 
> On Sat, 11 Feb 2006 22:24:47 +0100
> Jasper Huijsmans wrote:
> 
>>> ** (xfce4-panel:4182): CRITICAL **: Ein Item wurde unerwartet entfernt:
>>> "Verve-Kommandozeile".
> 
> I got the same,
> 
> (xfce4-panel:653568): Gdk-WARNING **: gdkdrawable-x11.c:904 \
>   drawable is not a pixmap or window
> 
> ** (xfce4-panel:653568): CRITICAL **: An item was unexpectedly removed: \
>   "Verve Command Line".
> 
>> Well, it basically means your plugin crashes. Maybe I have
>> different libraries/dependencies installed, so my plugin may
>> not trigger the crash.
>>
>> I have to think about how to debug an external plugin properly.
>> Hmm, it would be kinda cool to have 'xfce4-<name>-plugin --debug'
>> which would run the plugin in a separate window...
> 
> From the crash above, I got a core dumped by xfce4-verve-plugin,
> attached stack trace shows a similar path to the crash though.
> 
> FYI Jannis, the installations in my machine are different from
> Linux's, i.e. my working SHELL is /usr/freeware/bin/bash,
> haven't PHP installed etc. which may cause a problem at frame
> 2 (while compile flag has `-g', it says `No locals.' in the
> full trace).
> 
> Regards,

Daichi, Jannis, please try the attached patch. I replaced 
g_strv_length() with G_N_ELEMENTS(). The first is only valid for NULL 
terminated arrays.

	Jasper
verve-array-size.patch (text/plain, 953 B)
Index: verve/verve-env.c
===================================================================
--- verve/verve-env.c	(revision 1049)
+++ verve/verve-env.c	(working copy)
@@ -142,18 +142,18 @@
   /* Ruby variants: */    "ruby", "ruby1.8", "ruby1.6",               
   /* Shells: */           "sh", "bash", "fish", "zsh", "csh",
   /* Python variants: */  "python", "python2.3", "python2.4",
-  /* PHP variants: */     "php", "php4", "php5",
+  /* PHP variants: */     "php", "php4", "php5", 
 };
 
 void
 verve_env_shells_init (VerveEnv *env)
 {
+  int i;
   /* Init shell hash table */
   env->shells = g_hash_table_new (g_str_hash, g_str_equal);
   
   /* Search shells in PATH and add existing ones to the hash table */
-  int i;
-  for (i=0; i<g_strv_length (supported_shells); i++)
+  for (i=0; i<G_N_ELEMENTS (supported_shells); i++)
   {
     gchar *shell_path = g_find_program_in_path (supported_shells[i]);
     if (G_LIKELY (shell_path != NULL))