AW: gobject floating reference count



> -----Ursprüngliche Nachricht-----
> Von: gtkmm-list-bounces gnome org [mailto:gtkmm-list-
> bounces gnome org] Im Auftrag von Povietkin Konstantin
> Gesendet: Donnerstag, 03. Februar 2011 21:49
> An: GTKMM-List
> Betreff: gobject floating reference count
> 
> [...]
> Can somebody explain me what shall I do if i want to get reference in this
> situation:
> 
> void someFunc( GVariant * k )
> {
> 	k = some_glib_method( );
> }
> ....
> GVariant * ref;
> ....
> 
> someFunc( ref );

You have 3 possibilities:

void someFunc( GVariant ** k )
{
	*k = some_glib_method( );
}
void someFunc( GVariant *& k )
{
	k = some_glib_method( );
}
GVariant* someFunc()
{
	return some_glib_method( );
}
....
GVariant * ref;
....

someFunc( &ref );
someFunc( ref );
ref =someFunc( );


Greetings,
Klaus



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