Re: [Bluez-devel] [PATCH] Make BluetoothClient work on all adapters

Bastien Nocera
2007-07-24T21:12:12Z

On Tue, 2007-07-24 at 22:54 +0200, Marcel Holtmann wrote:
> Hi Bastien,
>
> > > With this patch, we can now pass a NULL as the adapter to work with all
> > > the adapters. This is for use in the upcoming patch for the selector
> > > widget.
> >
> > And a tiny patch to fix the test-client's compilation.
>
> what is wrong with providing a convenience wrapper around the GObject
> unref function?

unref isn't destroy.

Destroy, as used in GTK+ for widgets (it's not used in glib) means you
destroy the widget, drop the refcount to 0, clean up, free the memory,
etc.

Unref means you reduce the refcount by 1. If you have > 1 reference
before running the command, then nothing happens apart from the refcount
being updates.

Wrapping a _destroy() function to call _unref() means you're mixing two
semantics. When you call _destroy() the object isn't destroyed, it's
refcount is reduced...