dive_trip_list & dive_table
Amit Chaudhuri
amit.k.chaudhuri at gmail.com
Mon Apr 15 00:42:16 PDT 2013
Hi all,
I'm trying to amend my Qt treeview to show dives from the xml data in
subsurface. My current test dive set is grouped as 5 dives in 2 trips.
When I query the members of struct dive_table from my mainwindow.cpp in
qt-gui/ I get a surprising result:
int nr == 0
int preexisting == 0
int allocated == 0
I was at least expecting nr == 10
I also checked the address of struct dive_table using printf("....%p") both
at my point of use and in parse_xml_buffer and they agree.
So my theory is that dives in trips are possibly stored in another place
and I have dive_trip_list as the likely candidate.
So, grep -r -n '*dive_trip_list' *.c *.h and I get 4 hits.
1) a comment
4) extern decl
2) divelist.c:57 dive_trip_t *dive_trip_list;
3) divelist-gtk.c:62 dive_trip_t *dive_trip_list;
Is the duplication of dive_trip_list a bug? Should one of these be extern?
If it's not a bug, how does C handle a duplicate declaration like this?
Is my theory right that dives in trips are moved out of tive_table into
dive_trip_list?
When I try and read the value of dive_trip_list I am getting a NULL
pointer. I think this is an order of initialisation thing. I seem to have
the right address but at the point in time I query it it hasn't been filled
in.
Tomaz - you may come across this when trying to populate your cylinder
info. [I came across this after looking at the start of your
MainWindow::on_actionClose_triggered() ]
A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130415/9a7961cf/attachment.html>
More information about the subsurface
mailing list