Hey,
I finally repaired the trouble !!
Tested it removing the break statement in the foreach loop...
So now it's good I think
Phil

Le Dimanche 27 Novembre 2005 15:18, Arieh Schneier a écrit :
> capture.c should allocate the memory and hence the reason that ng_vid_init
> takes a pointer.
>
> Harry did you try my hack to see if it works?
>
> Lio.
>
>
> ----- Original Message From: "Harry Vennik" -----
> Eh, or capture.c, at the beginning of function Capture_Open.
> It is just how you put it.
> Should capture.c allocate memory and give a pointer to ng_vid_init, or
> should
> ng_vid_init copy dev into allocated memory to make sure it is always ok?
>
> Op zondag 27 november 2005 14:30, schreef Harry Vennik:
> > Yeah!!!!! I now look at the code, and I found it!!!!
> > grab-ng.c line 661
> >
> > Phil, you will see it in a second! Have fun!
> >
> > Harry
> >
> > Op zondag 27 november 2005 11:51, schreef Le Philousophe - Phil:
> > > Hi,
> > > I get the thing !! You are totally right !!
> > > In the Harry's mail I saw the bug in the bad pointer to next : it
> > > points on the stack !!! And the stack was erased !! Good I will fix it
> > > !! Thanks to all
> > > Phil
> > >
> > > Le Dimanche 27 Novembre 2005 11:43, Arieh Schneier a écrit :
> > > > > > *) Linked lists in libng are built by linking to a root pointer,
> > > > > > that is allocated by the caller. This means that if you have a
> > > > > > linked list as member of a struct, the first item in the list
> > > > > > will actually be that member. Furthermore, it's a doubly linked,
> > > > > > circular list. This is all fine, as long as you use the original
> > > > > > root pointer. As soon as you copy it, for example by assigning
> > > > > > the struct, the root pointer will be at a different address.
> > > > > > However, inside the linked list there are two
> > > >
> > > > pointers
> > > >
> > > > > > pointing to the old address, so as soon as a function traverses
>
> the
>
> > > > entire
> > > >
> > > > > > list, you will have a dangling pointer bug.
> > > > >
> > > > > This is how things may go, but I think the dangling pointer problem
> > > > > has a different cause in this case. I think so because of the
> > > > > unlikely value of
> > > >
> > > > the
> > > >
> > > > > pointer in an otherwise correctly filled structure for the 'Gain
> > > > > Level' attribute. I think there is just some buggy code in libng
>
> that
>
> > > > > happens to overwrite the pointer with something else.
> > > >
> > > > No, after examining the code I think I agree with Willem Monsuwe. The
> > > > problem is the linked list head is the first element and is embedded
>
> in
>
> > > > the ng_devstate, then when you copy the struct the pointer to it from
> > > > the second and last elements is invalidated.
> > > > There are 2 ways around this (if indeed that is correct), 1 is a very
> > > > quick hack that 'should' work: After the line:
> > > >   captureItem->dev = dev;
> > > > Add these lines:
> > > >   captureItem->dev->attrs->next->prev = &(captureItem->dev.attrs);
> > > >   captureItem->dev->attrs->prev->next = &(captureItem->dev.attrs);
> > > >
> > > > The other, more correct, way is to not use the temporary struct
>
> "struct
>
> > > > ng_devstate dev;" and create the captureItem earlier so that whenever
> > > > we used the variable dev you use the structure actually in
>
> captureItem.
>
> > > > Harry, a quick way to tell if that actually is the problem is in your
> > > > stacktrace where you gave the output for id 1 (where I'm assuming
> > > > that id 1 was the first call) try giving the value of
> > > > &(&capItem->dev)->attrs and see if it actually is the value of the
>
> prev
>
> > > > from the first and next from the last (as they are equal!).
> > > >
> > > >
> > > > Anyway try the hack above and cross your fingers (I think that is
> > > > supposed to be .attrs and not ->attrs).
> > > >
> > > > Lio
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_idv37&alloc_id865&op=Click
> _______________________________________________
> Amsn-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/amsn-devel



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Amsn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amsn-devel

Reply via email to