示例#1
0
static void __delete_handler(struct oh_handler *h)
{
        GSList *node = NULL;
        struct oh_plugin *plugin = NULL;

        if (!h) return;

        /* Subtract one from the number of handlers using this plugin */
        plugin = oh_get_plugin(h->plugin_name);
        if (!plugin) {
                dbg("BAD ERROR - Handler loaded, but plugin does not exist!");
        } else {
                plugin->handler_count--;
                oh_release_plugin(plugin);
        }

        /* Free the oh_handler members first, then the handler. */
        /* FIXME: Where/When should the handler config table be freed? */
        for (node = h->dids; node; node = node->next) {
                g_free(node->data);
        }
        g_slist_free(h->dids);
        g_static_rec_mutex_free(&h->lock);
        g_static_rec_mutex_free(&h->refcount_lock);
        g_free(h);
}
示例#2
0
/**
 * oh_create_domain
 * @capabilities:
 * @isPeer:
 * @tag:
 *
 *
 *
 * Returns: Domain id of newly created domain, or 0 if failed to create.
 **/
SaHpiDomainIdT oh_create_domain(SaHpiDomainCapabilitiesT capabilities,
                                SaHpiTimeoutT   aitimeout,
                                SaHpiTextBufferT *tag)
{
        struct oh_domain *domain = NULL;
        static SaHpiDomainIdT id = OH_FIRST_DOMAIN; /* domain ids will start at 1 */
        struct oh_global_param param = { .type = OPENHPI_DEL_SIZE_LIMIT };
        char del_filepath[SAHPI_MAX_TEXT_BUFFER_LENGTH*2];

        domain = g_new0(struct oh_domain,1);
        if (!domain) return 0;

        domain->capabilities = capabilities;
        domain->ai_timeout = aitimeout;
        domain->is_peer = SAHPI_FALSE;
        oh_init_rpt(&(domain->rpt));

        if (tag)
                memcpy(&(domain->tag), tag, sizeof(SaHpiTextBufferT));

        oh_get_global_param(&param);

        domain->del = oh_el_create(param.u.del_size_limit);
        domain->sessions = g_array_sized_new(FALSE, TRUE,
                                             sizeof(SaHpiSessionIdT),
                                             OH_SESSION_PREALLOC);

        g_static_rec_mutex_init(&(domain->lock));
        g_static_rec_mutex_init(&(domain->refcount_lock));

        if (!domain->del || !domain->sessions) {
                g_free(domain->del);
                g_array_free(domain->sessions, TRUE);
                g_static_rec_mutex_free(&(domain->lock));
                g_static_rec_mutex_free(&(domain->refcount_lock));
                g_free(domain);
                return 0;
        }

        param.type = OPENHPI_DEL_SAVE;
        oh_get_global_param(&param);

        g_static_rec_mutex_lock(&(oh_domains.lock)); /* Locked domain table */
        domain->id = id++;
        if (param.u.del_save) {
                param.type = OPENHPI_VARPATH;
                oh_get_global_param(&param);
                snprintf(del_filepath,
                         SAHPI_MAX_TEXT_BUFFER_LENGTH*2,
                         "%s/del.%u", param.u.varpath, domain->id);
                oh_el_map_from_file(domain->del, del_filepath);
        }
        g_hash_table_insert(oh_domains.table, &(domain->id), domain);
        g_static_rec_mutex_unlock(&(oh_domains.lock));  /* Unlocked domain table */

        return domain->id;
}
示例#3
0
static void __delete_domain(struct oh_domain *d)
{
        oh_flush_rpt(&d->rpt);
        oh_el_close(d->del);
        oh_close_alarmtable(d);
        __free_drt_list(d->drt.list);
        g_static_rec_mutex_free(&d->lock);
        g_static_rec_mutex_free(&d->refcount_lock);
        g_free(d);
}
示例#4
0
static void __delete_plugin(struct oh_plugin *p)
{
        if (!p) return;

        g_free(p->name);
        g_static_rec_mutex_free(&p->lock);
        g_static_rec_mutex_free(&p->refcount_lock);
        g_free(p->abi);
        if (p->dl_handle) {
                lt_dlclose(p->dl_handle);
        }
        g_free(p);
}
示例#5
0
static void __delete_domain(struct oh_domain *d)
{
        disconnect_parent(d); /* Remove drt entry from parent */
        disconnect_peers(d); /* Remove drt entry from brothers */

        oh_flush_rpt(&d->rpt);
        oh_el_close(d->del);
        oh_close_alarmtable(d);
        __free_drt_list(d->drt.list);
        g_array_free(d->sessions, TRUE);
        g_static_rec_mutex_free(&d->lock);
        g_static_rec_mutex_free(&d->refcount_lock);
        /*oh_destroy_domain_sessions(d->id);*/ /* Not needed after all */
        g_free(d);
}
CGenericCanvas::~CGenericCanvas(void)
{
  beginUpdate();
  disableEvents();

  // Release all managed data. Start with the visual parts to avoid frequent change events between model and other elements.
  for (CViews::iterator iterator = FViews.begin(); iterator != FViews.end(); ++iterator)
    delete *iterator;
  for (CLayers::iterator iterator = FLayers.begin(); iterator != FLayers.end(); ++iterator)
    delete *iterator;

  delete FModel;
  delete FAnimationManager;

  // Release the lock we placed in the constructor.
  // If this is the last GC instance then also the font manager can be released.
  unlockFontManager();
  endUpdate();

#ifdef _WINDOWS
  DeleteCriticalSection(&FLock);
#else
  g_static_rec_mutex_free(&FLock);
#endif
}
static void
intervaltree_finalize (GObject *object)
{
	EIntervalTreePrivate *priv = E_INTERVALTREE_GET_PRIVATE (object);

	if (priv->root) {
		g_free (priv->root);
		priv->root = NULL;
	}

	if (priv->nil) {
		g_free (priv->nil);
		priv->nil = NULL;
	}

	if (priv->id_node_hash) {
		g_hash_table_destroy (priv->id_node_hash);
		priv->id_node_hash = NULL;
	}

	g_static_rec_mutex_free (&priv->mutex);

	/* Chain up to parent's finalize() method. */
	G_OBJECT_CLASS (e_intervaltree_parent_class)->finalize (object);
}
示例#8
0
static void
gst_hls_demux_dispose (GObject * obj)
{
  GstHLSDemux *demux = GST_HLS_DEMUX (obj);

  g_cond_free (demux->fetcher_cond);
  g_mutex_free (demux->fetcher_lock);

  g_cond_free (demux->thread_cond);
  g_mutex_free (demux->thread_lock);

  if (GST_TASK_STATE (demux->task) != GST_TASK_STOPPED) {
    gst_task_stop (demux->task);
    gst_task_join (demux->task);
  }
  gst_object_unref (demux->task);
  g_static_rec_mutex_free (&demux->task_lock);

  gst_object_unref (demux->fetcher_bus);
  gst_object_unref (demux->fetcherpad);

  gst_hls_demux_reset (demux, TRUE);

  gst_object_unref (demux->download);

  G_OBJECT_CLASS (parent_class)->dispose (obj);
}
示例#9
0
Images::~Images()
{
    while ( ! decoders.empty() )
    {
        delete decoders.front();
        decoders.pop_front();
    }

    if ( external_decoder )
    {
        delete external_decoder;
    }

#ifndef TP_PRODUCTION

    // Get rid of the weak ref in case an image is destroyed after we are.

    for ( ImageMap::iterator it = images.begin(); it != images.end(); ++it )
    {
        g_object_weak_unref( G_OBJECT( it->first ), texture_destroyed_notify, this );
    }

#endif

    if ( cache )
    {
    	delete cache;
    }

    g_static_rec_mutex_free( & mutex );
}
示例#10
0
文件: core.c 项目: TDKPS/lgi
/* GC method for GStaticRecMutex structure, which lives inside lua_State. */
static int
call_mutex_gc (lua_State* L)
{
  LgiStateMutex *mutex = lua_touserdata (L, 1);
  g_static_rec_mutex_unlock (mutex->mutex);
  g_static_rec_mutex_free (&mutex->state_mutex);
  return 0;
}
static void
fs_msn_session_finalize (GObject *object)
{
  FsMsnSession *self = FS_MSN_SESSION (object);

  g_static_rec_mutex_free (&self->mutex);

  parent_class->finalize (object);
}
示例#12
0
static void
gst_fake_sink_finalize (GObject * obj)
{
  GstFakeSink *sink = GST_FAKE_SINK (obj);

  g_static_rec_mutex_free (&sink->notify_lock);

  G_OBJECT_CLASS (parent_class)->finalize (obj);
}
示例#13
0
static void
gst_identity_finalize (GObject * object)
{
  GstIdentity *identity;

  identity = GST_IDENTITY (object);

  g_free (identity->last_message);
  g_static_rec_mutex_free (&identity->notify_lock);

  G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_identity_finalize (GObject * object)
{
  GstIdentity *identity;

  identity = GST_IDENTITY (object);

  g_free (identity->last_message);

#if !GLIB_CHECK_VERSION(2,26,0)
  g_static_rec_mutex_free (&identity->notify_lock);
#endif

  G_OBJECT_CLASS (parent_class)->finalize (object);
}
示例#15
0
static void
gst_sdp_demux_finalize (GObject * object)
{
  GstSDPDemux *demux;

  demux = GST_SDP_DEMUX (object);

  /* free locks */
  g_static_rec_mutex_free (demux->stream_rec_lock);
  g_free (demux->stream_rec_lock);

  g_object_unref (demux->adapter);

  G_OBJECT_CLASS (parent_class)->finalize (object);
}
示例#16
0
文件: lcm_udp.c 项目: ghorn/conftron
void
lcm_udpm_destroy (lcm_udpm_t *lcm) 
{
    dbg (DBG_LCM, "closing lcm context\n");
    _destroy_recv_parts (lcm);

    if (lcm->sendfd >= 0)
        _close_socket(lcm->sendfd);

    lcm_internal_pipe_close(lcm->notify_pipe[0]);
    lcm_internal_pipe_close(lcm->notify_pipe[1]);

    g_static_rec_mutex_free (&lcm->mutex);
    g_static_mutex_free (&lcm->transmit_lock);
    free (lcm);
}
示例#17
0
static void
gst_swfdec_dispose (GObject * object)
{
  GstSwfdec *swfdec = GST_SWFDEC (object);

  gst_task_stop (swfdec->task);
  gst_task_join (swfdec->task);
  gst_object_unref (swfdec->task);
  g_static_rec_mutex_free (&swfdec->mutex);

  g_object_unref (swfdec->adapter);

  swfdec_decoder_free (swfdec->decoder);

  G_OBJECT_CLASS (parent_class)->dispose (object);
}
示例#18
0
static void
gst_vader_finalize(GObject *gobject)
{
    GstVader *vader = GST_VADER(gobject);

    g_static_rec_mutex_free(&vader->mtx);
    if (vader->dumpfile)
        fclose(vader->dumpfile);
    if (vader->dumpdir)
        g_free(vader->dumpdir);
    if (vader->pre_buffer) {
      while (g_list_length (vader->pre_buffer) > 0) {
        GstBuffer *prebuf;
        prebuf = (g_list_first (vader->pre_buffer))->data;
        vader->pre_buffer = g_list_remove (vader->pre_buffer, prebuf);
        gst_buffer_unref (prebuf);
      }
    }
    GST_CALL_PARENT(G_OBJECT_CLASS, finalize, (gobject));
}
示例#19
0
static void
sim_database_impl_finalize (GObject  *gobject)
{
  SimDatabase *database = SIM_DATABASE (gobject);

  if (database->_priv->name)
    g_free (database->_priv->name);
  if (database->_priv->provider)
    g_free (database->_priv->provider);
  if (database->_priv->dsn)
    g_free (database->_priv->dsn);

  gda_connection_close (database->_priv->conn);

  g_static_rec_mutex_free (database->_priv->mutex);

  g_free (database->_priv);

  G_OBJECT_CLASS (parent_class)->finalize (gobject);
}
示例#20
0
void
lcm_destroy (lcm_t * lcm)
{
    if (lcm->provider)
        lcm->vtable->destroy (lcm->provider);
    
    g_hash_table_foreach (lcm->handlers_map, map_free_handlers_callback, NULL);
    g_hash_table_destroy (lcm->handlers_map);

    for (unsigned int i = 0; i < lcm->handlers_all->len; i++) {
        lcm_subscription_t *h = (lcm_subscription_t *) g_ptr_array_index(lcm->handlers_all, i);
        h->callback_scheduled = 0; // XXX hack...
        lcm_handler_free(h);
    }
    g_ptr_array_free(lcm->handlers_all, TRUE);

    g_static_rec_mutex_free (&lcm->mutex);
    free(lcm);
#ifdef WIN32
    WSACleanup();
#endif
}
示例#21
0
static GstStateChangeReturn
gst_qt_moov_recover_change_state (GstElement * element,
    GstStateChange transition)
{
  GstStateChangeReturn ret;
  GstQTMoovRecover *qtmr = GST_QT_MOOV_RECOVER_CAST (element);

  switch (transition) {
    case GST_STATE_CHANGE_NULL_TO_READY:
      qtmr->task = gst_task_create (gst_qt_moov_recover_run, qtmr);
      qtmr->task_mutex = g_new (GStaticRecMutex, 1);
      g_static_rec_mutex_init (qtmr->task_mutex);
      gst_task_set_lock (qtmr->task, qtmr->task_mutex);
      break;
    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
      gst_task_start (qtmr->task);
      break;
    default:
      break;
  }

  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);

  switch (transition) {
    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
      gst_task_stop (qtmr->task);
      gst_task_join (qtmr->task);
      break;
    case GST_STATE_CHANGE_READY_TO_NULL:
      g_assert (gst_task_get_state (qtmr->task) == GST_TASK_STOPPED);
      gst_object_unref (qtmr->task);
      qtmr->task = NULL;
      g_static_rec_mutex_free (qtmr->task_mutex);
      break;
    default:
      break;
  }
  return ret;
}
示例#22
0
文件: fm-job.c 项目: Gontxal0/libfm
static void fm_job_dispose(GObject *object)
{
    FmJob *self;

    g_return_if_fail(object != NULL);
    g_return_if_fail(FM_IS_JOB(object));

    self = (FmJob*)object;

    if(self->cancellable)
    {
        g_signal_handlers_disconnect_by_func(self->cancellable, on_cancellable_cancelled, self);
        g_object_unref(self->cancellable);
        self->cancellable = NULL;
#if GLIB_CHECK_VERSION(2, 32, 0)
        g_rec_mutex_clear(&self->stop);
#else
        g_static_rec_mutex_free(&self->stop);
#endif
    }

    G_OBJECT_CLASS(fm_job_parent_class)->dispose(object);
}
示例#23
0
void
gst_alsa_mixer_free (GstAlsaMixer * mixer)
{
  g_return_if_fail (mixer != NULL);

  if (mixer->task) {
    if (write (mixer->pfd[1], "stop", 5) <= 0) {
      GST_ERROR ("Cannot send " "stop" " to alsamixer task");
      close (mixer->pfd[1]);
      mixer->pfd[1] = -1;
    }

    if (gst_task_join (mixer->task) == FALSE) {
      GST_ERROR ("Cannot join alsamixer task");
    }

    gst_object_unref (mixer->task);
    mixer->task = NULL;
  }

  g_static_rec_mutex_free (mixer->task_mutex);
  g_free (mixer->task_mutex);
  mixer->task_mutex = NULL;

  if (mixer->pfd[0] > 0) {
    close (mixer->pfd[0]);
    mixer->pfd[0] = -1;
  }

  if (mixer->pfd[1] > 0) {
    close (mixer->pfd[1]);
    mixer->pfd[1] = -1;
  }

  if (mixer->interface) {
    g_object_unref (G_OBJECT (mixer->interface));
    mixer->interface = NULL;
  }

  if (mixer->device) {
    g_free (mixer->device);
    mixer->device = NULL;
  }

  if (mixer->cardname) {
    g_free (mixer->cardname);
    mixer->cardname = NULL;
  }

  if (mixer->tracklist) {
    g_list_foreach (mixer->tracklist, (GFunc) g_object_unref, NULL);
    g_list_free (mixer->tracklist);
    mixer->tracklist = NULL;
  }

  if (mixer->handle) {
    snd_mixer_close (mixer->handle);
    mixer->handle = NULL;
  }

  g_static_rec_mutex_free (mixer->rec_mutex);
  g_free (mixer->rec_mutex);
  mixer->rec_mutex = NULL;

  g_free (mixer);
}