On Wed, Jul 12, 2006 at 08:05:56PM +0100, Adam Tee wrote:
> I am having an issue when using g_queue_find.  Basically, I am using it
> to find a filename in a queue but it is returning NULL all the time even
> when the filename is there.
> 
> 
> The code I am using is:
> 
> if(g_queue_find(gui->prefs->history, gui->si->filename->str))
>   {
> #ifdef DEBUG
>         g_print("File not in history list\n");
> #endif
>        if(g_queue_get_length(gui->prefs->history) > MAX_HISTORY)
>        {
>               gpointer data = g_queue_pop_head(gui->prefs->history);
>       if(data)
>         g_free(data);
>     }
> 
> history is a queue containing strings as its data.
> 
> Is there anything obvious with this code ??

Is the string gui->si->filename->str *physically* the same
string (i.e. the same pointer) as some data in the queue?

g_queue_find() simply compares pointers, to check for an
equal string you have to use g_queue_find_custom() with
string comparison.

Yeti


--
Anonyms eat their boogers.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to