Hi all,
as I was trying to nail down the bug why my gtk4_list_clocks only ever update one of the clocks and not all of them, I’ve traced down the problem to be in GLib.SList.prepend()
.
Changing from GLib.SList
to Gee.ArrayList
didn’t solve the problem.
In the c code example a list of all clock widgets were created by appending them to a singly linked list. I’ve tried to mimic that but as it turned out the list size is always 1 and only one object ever get appended.
void start_ticking () {
/* if no clock is ticking yet, start */
if (ticking_clock_id == 0) {
ticking_clock_id = GLib.Timeout.add_seconds (1, tick);
}
ticking_clocks.add (instance); // Bug
// Although instance pointer is different according to the number of instantiated objects!!!
print ("Clock instance %p\n", instance);
// always 1 !!!
print ("Number of ticking clocks %d\n", ticking_clocks.size);
}
Could somebody please help to point out the problem?
Thanks in advance.