Re: should I ref/strdup values in my _set_property() method



The one I still have open is
gdk/gdkdisplaymanager.c:141

default_display = g_value_get_object (value);

Anyway I will take some time on this weekend to study it deeper, for writing it
all down for the GObject tutorial.

Stefan

Owen Taylor wrote:
On Thu, 2004-09-23 at 13:13 +0200, Stefan Kost wrote:

I was asking because in the gtk (and other) source one can find many places
where version a) is used (no strdup, no ref).


I expect if you look deeper, you'll find that the strdup or ref is
being made -- e.g., from gtk_label_set_property:

    case PROP_LABEL:
      gtk_label_set_label (label, g_value_get_string (value));

Here gtk_label_set_label() copies the string.

Regards,
                                              Owen


-- 
      \|/            Stefan Kost
     <@ @>           private            business
+-oOO-(_)-OOo------------------------------------------------------ - - -  -   -
|       __  Address  Simildenstr. 5     HTWK Leipzig, Fb IMN, Postfach 301166
|      ///           04277 Leipzig      04251 Leipzig
| __  ///            Germany            Germany
| \\\///    Phone    +49341 2253538     +49341 30766101
|  \__/     EMail    st_kost_at_gmx.net kost_at_imn.htwk-leipzig.de
|           WWW      www.sonicpulse.de  www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - -  -    -


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