I don't understand why freeing an array requires knowing the size of it. The call for freeing a block of memory is free(void *data);, without any size in there. The libc keeps track of the size of each block in its allocator.
On Tue, Dec 18, 2012 at 1:58 PM, Günther Wutz <[email protected]> wrote: > I can live with that. I thought it should be possible, because its a > normal thing in an object oriented fashion. I looked at the generated > output from Vala, but they does not use multidimensional arrays, they > make the calculation themself and use a one-dimensional array. Then > freeing is simple :) > > It works, if i use g_object_get(...), its only throws critical messages. > The problem is a refcount-check. If i make myself an cast to the correct > structure and use the variables would maybe work but its only a > workaround. > > Am Dienstag, den 18.12.2012, 05:24 -0500 schrieb Jasper St. Pierre: > > The issue is that the class has already been finalized. At that point, > > you are no longer allowed to access any properties. > > > > > > I suppose you could also try and access raw storage from class A, but > > storing any data you'll need to free something in class B when you > > allocate it seems like the cleanest solution to me. > > > > > > > > On Tue, Dec 18, 2012 at 5:22 AM, Milosz Derezynski > > <[email protected]> wrote: > > Use g_object_get(CAST_TO_PARENT_TYPE(obj), "x", &x, NULL); > > > > > > On Tue, Dec 18, 2012 at 4:57 AM, Günther Wutz > > <[email protected]> wrote: > > Hi, > > > > i have read the development stuff about GObject > > initialization and > > destruction of an Object. But i have currently a > > problem, which drives > > me crazy. > > > > I have an Class A, which stores two Integer as > > properties (say x and y) > > and an Class B which inherits from A and makes a > > multidimensional array > > on the heap with size x*y. In my finalize method i > > want to free the > > dynamically allocated multidimensional array, > > therefore i ned the > > borders from Class A. If i write g_object_get(obj, > > "x", &x, NULL); i get > > an > > > > GLib-GObject-CRITICAL **: g_object_ref: assertion > > `object->ref_count > > > 0' failed > > > > GLib-GObject-CRITICAL **: g_object_unref: assertion > > `object->ref_count > > > 0' failed > > > > Especially the cast to Class A fails. How would i do > > this correctly? > > > > I hope somebody out there can help me to understand > > this issue. > > > > Günther > > > > _______________________________________________ > > gtk-list mailing list > > [email protected] > > https://mail.gnome.org/mailman/listinfo/gtk-list > > > > > > > > > > -- > > Everything is Original. > > > > _______________________________________________ > > gtk-list mailing list > > [email protected] > > https://mail.gnome.org/mailman/listinfo/gtk-list > > > > > > > > > > -- > > Jasper > > > > > > _______________________________________________ > > gtk-list mailing list > > [email protected] > > https://mail.gnome.org/mailman/listinfo/gtk-list > > > _______________________________________________ > gtk-list mailing list > [email protected] > https://mail.gnome.org/mailman/listinfo/gtk-list > -- Jasper
_______________________________________________ gtk-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gtk-list
