Jeff Foster wrote:
>
>
> Now the problems... those damn 'packet window', (why did I
> add that?). When there is a packet window open, we have
> tvbuff for both the main display and the packet window
> active, (same problem for my idea). So, using a list of
> tvbuffs will not work because it will see tvbuffs for
> both the main window and the 'packet window'.
>
> I'm stumped, any suggestions.
Is your list of tvbuffs *only* for freeing them? Or does
it have another use? If it's only for freeing them, then
you don't need them. The dissector can use the combination
of tvb_set_free_cb() and tvb_set_child_real_data()
to make sure that both the new guint8 array and the new
tvbuff are freed when appropriate.
I haven't looked at the packet window routines to see
how they handle their tvbuffs, that is, do they make
their own, or do they use the same one that the main GUI
is using. If they borrow the one that the main GUI is using,
you can take advantage of the reference counting in the
tvbuffs (tvb_increment_usage_count()). Then both the
main GUI and the packet wndow could call tvb_free_chain()
(Side note... I wonder if the tvb_free_chain() should be
removed and the functionality just be placed directly into
tvb_free()... I'll think about that). The reference
counting *should* work, and the tvbuff and all its
"children" should be freed when the reference count goes to 0.
--gilbert