Should I chain up finalize?



I found code like this in gio

static void
g_filter_input_stream_finalize (GObject *object)
{
  GFilterInputStream *stream;

  stream = G_FILTER_INPUT_STREAM (object);

  g_object_unref (stream->base_stream);

  G_OBJECT_CLASS (g_filter_input_stream_parent_class)->finalize (object);
}

It looks like I should also use
  G_OBJECT_CLASS (xxxxx_parent_class)->finalize (object);
to chain up instance finalize in my code.

BUT, I found that it caused parent class's finalize called twice when unref.

So, should I or should I NOT chain dispose and finalize in my code?

BTW : I think this should be clarified in Gobject's tutorial.

--
look to the things around you,the immediate world around you, if you are alive,it will mean something to you ——Paul Strand


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