Class Members and the Class Finalize Function



I'm using GLib 2.0 to create a "Gizmo" class that has a "GizmoPart"
object as one of the members of the Gizmo instance structure.  For most
instances of Gizmo, the GizmoPart object member is the same kind of
object.  Rather than create separate GizmoPart objects for each Gizmo
object, I'd prefer to create a common GizmoPart object and share it
between Gizmo objects that use that kind of GizmoPart object.

I add a static member to the Gizmo class structure and create it in the
class initialize function.  (I could store it with static scope within
the source file but then how could I destroy it?)  The logical place to
destroy (i.e., unreference, release, free) the shared class object is in
the class finalize function.  But the type system for some reason gives
a warning about "class finalize function specified for static type" and
refuses to register the class.

Why is that and what should I do about it?

Thanks,
Eric.




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