[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: can't remove entries from a table without a seg fault
- From: Miguel de Icaza <miguel nuclecu unam mx>
- To: gtk-app-devel-list redhat com
- CC: gtk-app-devel-list redhat com
- Subject: Re: can't remove entries from a table without a seg fault
- Date: Thu, 5 Nov 1998 18:06:12 -0600
> I'm having a hell of a time in removing items from a table.
> the code that adds the items is:
> gtk_table_attach(GTK_TABLE (channel_table),
> label[i], 0, 1, (i*2), (i*2)+1,
> GTK_FILL | GTK_EXPAND,
> GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0);
>
> the code that removes it is:
> gtk_container_remove(GTK_CONTAINER (channel_table),
> GTK_WIDGET (label[i]));
>
> when something is re-added into its previous place, the program seg faults
>
> i.e. when the first function is called again.
> the debugger (xxgdb) says the fault happens when gtk_table_attach() is
> called, (after previously having something there, and removing it)
>
> Any ideas what I'm doing wrong?
Yes, you are not taking the magic reference counting into account.
Check the reference counting doc in the Gtk+ distribution.
Just make sure you ref count the object once yourself and that you
decrement manually the refcount sometime later.
Miguel.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]