Re: testing that an object really has been destroyed in unittests



Hi Tristan,

uhm, should have switched on my brain - the weak_ref is a cool idea!

Stefan

Tristan Van Berkom wrote:
On Fri, 24 Sep 2004 19:22:52 +0200, Stefan Kost
<kost imn htwk-leipzig de> wrote:

hi hi,

has anyone an idea how I can verify that after a
 g_object_unref(myobj);
the object has been destroyed.

[...]

    You can use `g_object_weak_ref ()' to register a callback to be called
when the object is finalized.

You can not check if an object has been finalized after the fact for
the same reasons you can not check if a memory region has been
freed after freeing it.

Cheers,
                                                          -Tristan


-- 
      \|/            Stefan Kost
     <@ @>           private            business
+-oOO-(_)-OOo------------------------------------------------------ - - -  -   -
|       __  Address  Simildenstr. 5     HTWK Leipzig, Fb IMN, Postfach 301166
|      ///           04277 Leipzig      04251 Leipzig
| __  ///            Germany            Germany
| \\\///    Phone    +49341 2253538     +49341 30766101
|  \__/     EMail    st_kost_at_gmx.net kost_at_imn.htwk-leipzig.de
|           WWW      www.sonicpulse.de  www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - -  -    -


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