Re: GObject Destruction



Il Tue, 18 Dec 2012 04:57:52 +0100 Günther Wutz <android gunibert de> scrisse:

> 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

You are using g_object_get(), so I suppose the integers are stored
in the instance, not in the class (and consequentially the
finalize method refers to the instance finalization).

I always free dynamic stuff (included allocated memory) in
dispose(), not in finalize(), protecting it from double calls.
There you should have a still valid instance to query.

Ciao.
-- 
Nicola


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]