Re: warning or crash when removing widgets from box




Owen Taylor (otaylor@redhat.com) writes:

>Erm, no. ;-) Destroying a widget automatically removes it from it's
>parent, which unrefs it, so the original poster was absolutely
>correct.

>The warnings / segfaults seem to stem from trying to access
>a destroyed widget somewhere else in the code.

Thanks for the hint.  It fixed itself when I fixed another bug that (I
thought) was unrelated, and I pass along this other hint that may help
someone else: 

** Don't do a "list = g_list_remove(list, item)" inside the callback from 
a g_list_foreach(list).    It won't necessarily crash right there, but
funny pointer things will happen.

This is only one of my reservations about how g_list works, but I'm still
using them a lot because they're convenient and easily available anywhere
glib is.

Steve

-- 
Steve Tell | tell@cs.unc.edu | http://www.cs.unc.edu/~tell | KF4ZPF
Research Associate, Microelectronic Systems Laboratory
Computer Science Department, UNC@Chapel Hill.   W:919-962-1845



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