should I ref/strdup values in my _set_property() method
- From: Stefan Kost <kost imn htwk-leipzig de>
- To: gtk-app-devel-list gnome org
- Subject: should I ref/strdup values in my _set_property() method
- Date: Wed, 22 Sep 2004 15:44:37 +0200
hi hi,
my objects have stringand object properties too. what is the proper way to
handle them :
a.) -----------
statc void xxx_yyy_set_property(...) {
...
switch(property_id) {
case OBJECT_PROP:
myobject=g_value_get_object(value);
break;
case STRINTG_PROP:
mystring=g_value_get_string(value);
break;
}
}
b.) -----------
statc void xxx_yyy_set_property(...) {
...
switch(property_id) {
case OBJECT_PROP:
if(myobject) g_object_unref(myobject);
myobject=g_object_ref(g_value_get_object(value));
break;
case STRINTG_PROP:
if(mystring) g_free(mystring);
mystring=g_value_dup_string(value);
break;
}
}
Ciao
Stefan
--
http://www.buzztard.org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]