Re: glib ref counting problem



Stefan Kost wrote:
[...]
I will try to make it clearer.
application creates the BtSong
  BtSong->refct=1
the songs instance init creates the private BtPattern and BtSetup instances
and passes itself to their constructiors.
  BtSong->refct=3
  BtPattern->refct=1
  BtSetup->refct=1

Why should (G_OBJECT(BtSong)->ref_count > 1) ?

BtPattern & BtSetup do *not* need a reference on BtSong if
BtPattern & BtSetup *belong* to BtSong.

- App creates (and "owns") BtSong
  - BtSong creates (and "owns") BtPattern
  - BtSong creates (and "owns") BtSetup

- App unref's BtSong
  - BtSong unref's BtPattern
  - BtSong unref's BtSetup

Cheers,
                           -Tristan



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