[Mesa-dev] exec_list question

Timothy Arceri t_arceri at yahoo.com.au
Sun Jan 12 01:21:03 PST 2014


Ok please ignore I understand how exec_list works now. What I was trying
to do was silly I'll need to figure out a different solution sorry about
the noise.

On Sun, 2014-01-12 at 19:39 +1100, Timothy Arceri wrote:
> I just tried the below code which is much cleaner but it to causes the
> original list to lose the last node. 
> 
> exec_node *node = type->array_specifier->array_dimensions.head->next;
> for (/* nothing */; !node->is_tail_sentinel(); node = node->next) {
>    array_specifier->array_dimensions.push_tail(node);
> }
> 
> I originally thought the pointer was being freed by an access to the
> copied list somewhere but since foreach_list_safe makes things work
> there must be something else happening.
> 
> 
> On Sun, 2014-01-12 at 19:08 +1100, Timothy Arceri wrote:
> > Hi Guys,
> > 
> > I've been chasing my tail most of the afternoon using exec_list
> > basically I was just trying to copy all but the first element from one
> > list to another using the code bellow. 
> > 
> >             exec_list *copy_dims =
> > &type->array_specifier->array_dimensions;
> >             int i = 0;
> >             //TODO: has to be better way to copy all dimension but the
> > first one
> >             foreach_list (node, copy_dims) {
> >                if(i>0)
> >                   array_specifier->array_dimensions.push_tail(node);
> >                i++;
> >             }
> > 
> > But when doing this the last element from the list I was coping FROM was
> > somehow being lost.
> > 
> > Replacing foreach_list with foreach_list_safe seems to have fixed the
> > problem. However I don't really understand why is someone able to
> > explain to me what's happening here?
> > 
> 




More information about the mesa-dev mailing list