newsAdvanced Gtk+ Sequencer - News: fixed ref-count

 
 
Latest News
Advanced Gtk+ Sequencer v2.3.2 released posted by jkraehemann, Tue 10 Sep 2019 07:32:44 AM UTC - 0 replies
Advanced Gtk+ Sequencer v2.3.x - implementing ags_filter_util.c posted by jkraehemann, Sun 18 Aug 2019 10:10:42 AM UTC - 0 replies
Further optimization in ags_audio_buffer_util.c posted by jkraehemann, Wed 07 Aug 2019 12:22:48 AM UTC - 0 replies
GCC builtin vector functions and a lock free soundcard buffer posted by jkraehemann, Mon 29 Jul 2019 03:36:31 PM UTC - 0 replies
Advanced Gtk+ Sequencer v2.2.5 released posted by jkraehemann, Tue 25 Jun 2019 06:43:09 PM UTC - 0 replies
[Submit News]
[85 news in archive]

fixed ref-count

Item posted by Joël Krähemann <jkraehemann> on Sat 09 Feb 2019 02:46:41 PM UTC.

The following code snipped is from GLib-2.0 API Reference Manual:

gint intval;
gchar *strval;
GObject *objval;

g_object_get (my_object,
              "int-property", &intval,
              "str-property", &strval,
              "obj-property", &objval,
              NULL);

// Do something with intval, strval, objval

g_free (strval);
g_object_unref (objval);

As you might have recognized objval needs a call to g_object_unref() after retrieving using g_object_get().

I was not aware of this.

Reworked all properties

The rework of all properties was just done, it took 3 days. For properties returning GList containing objects, you need to call g_object_unref, now.

Here you see the AgsAudio:play get property:

case PROP_PLAY:
  {
    pthread_mutex_t *play_mutex;

    /* get play mutex */
    pthread_mutex_lock(ags_audio_get_class_mutex());

    play_mutex = audio->play_mutex;

    pthread_mutex_unlock(ags_audio_get_class_mutex());

    /*  */
    pthread_mutex_lock(play_mutex);

    g_value_set_pointer(value,
                        g_list_copy_deep(audio->play,
                                         (GCopyFunc) g_object_ref,
                                         NULL));

    pthread_mutex_unlock(play_mutex);
  }
  break;


by Joël

No messages in fixed ref-count

 

Back to the top


Powered by Savane 3.5