Re: How to wrap objects based on GInitiallyUnowned (floating references)?



hi,

2006/11/14, Murray Cumming <murrayc murrayc com>:
On Tue, 2006-11-14 at 18:03 +0100, Philipp Kerling wrote:
> Hi,
>
> how can I wrap a C object which derives from GInitiallyUnowned (and
> especially NOT from GObject or GtkObject) to C++? I found no simple m4
> macro like _CLASS_GINITIALLYUNOWNED for it. If I use GObject and
> _CLASS_GOBJECT,  a sample application of the library crashes at
> shutdown, because the C++ class doesn´t store a reference on the
> underlying C instance and so it tries to free the memory twice.

I think you should be able to use G_OBJECT with this, but I would like
to know why the object derives from GInitiallyUnowned instead of from
GObject. Maybe it should be used like GtkObject without depending on GTK
+. The author could tell you.
_CLASS_GOBJECT doesn´t work, because then the application crashes at
shutdown, as mentioned above.
Here is a short explanation of GInitiallyUnowned:
"GInitiallyUnowned is derived from GObject. The only difference
between the two is that the initial reference of a GInitiallyUnowned
is flagged as a floating reference. This means that it is not
specifically claimed to be "owned" by any code portion. The main
motivation for providing floating references is C convenience."
See http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html,
section Description for details.

May I see the code, so I can try to debug this problem for you. Please
provide a tarball or repository checkout details, with information about
how to build it.

http://download.savannah.gnu.org/releases/criawips/libccc-0.0.4.tar.gz
build
./configure && make && sudo make install

http://files.coding-industry.de/libcccmm-0.1.0.tar.bz2
build: ./configure && make


best regards,
phiker



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