Re: newbie and g_list*



"Michael P. Jarreau" wrote:

>     // This works.
>     GList *tmp = f ();
>     list = g_list_remove (list, tmp->data);
>
>     // This creates a segmentation fault and I don't understand why.
>     free (tmp->data);
>

The problem is not with the data but with the tmp.
What you want is:

GList *tmp = f();
void *data = tmp->data;
list = g_list_remove(list,data);
free (data);

The tmp is freed by g_list_remove, but I'm assuming that
tmp is a node on list.

-- Steve.

My appologies if this is duplicated, I tried to mail this from my
home account that uses fetchmail, and doesn't have the same
return address as the mail on the list.

begin:vcard 
n:Rostedt;Steven
tel;fax:607-751-6025
tel;work:607-751-5657
x-mozilla-html:FALSE
org:Lockheed Martin Systems Integration;Advanced Technologies
version:2.1
email;internet:steven rostedt lmco com
title:Staff Programmer
adr;quoted-printable:;;Mail Drop 0210=0D=0A1801 State Route 17C;Owego;NY;13827;
x-mozilla-cpt:;28512
fn:Steven Rostedt
end:vcard


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