예제 #1
0
void _owr_session_clear_closures(OwrSession *session)
{
    if (session->priv->on_remote_candidate) {
        g_closure_invalidate(session->priv->on_remote_candidate);
        g_closure_unref(session->priv->on_remote_candidate);
        session->priv->on_remote_candidate = NULL;
    }
    if (session->priv->on_local_candidate_change) {
        g_closure_invalidate(session->priv->on_local_candidate_change);
        g_closure_unref(session->priv->on_local_candidate_change);
        session->priv->on_local_candidate_change = NULL;
    }
}
예제 #2
0
static void
thunar_uca_provider_child_watch_destroy (gpointer  user_data,
                                         GClosure *closure)
{
  ThunarUcaProvider *uca_provider = THUNAR_UCA_PROVIDER (user_data);
  GClosure          *child_watch;

  /* leave if the closure is not the one we're watching */
  if (uca_provider->child_watch == closure
      || closure == NULL)
    {
      /* reset child watch and path */
      if (G_UNLIKELY (uca_provider->child_watch != NULL))
        {
          child_watch = uca_provider->child_watch;
          uca_provider->child_watch = NULL;

          g_closure_invalidate (child_watch);
          g_closure_unref (child_watch);
        }

      g_free (uca_provider->child_watch_path);
      uca_provider->child_watch_path = NULL;
    }
}
예제 #3
0
static VALUE
rg_invalidate(VALUE self)
{
    GClosure* closure = RVAL2BOXED(self, G_TYPE_CLOSURE);
    g_closure_invalidate(closure);
    return self;
}
예제 #4
0
파일: mainloop.c 프로젝트: sjokkis/gjs
static void
closure_destroy_notify(void *data)
{
    GClosure *closure;

    closure = data;

    g_closure_invalidate(closure);
    g_closure_unref(closure);
}
예제 #5
0
파일: mooplugin.c 프로젝트: cmotc/medit
static void
meth_free (MooPluginMeth *meth)
{
    if (meth)
    {
        g_free (meth->param_types);
        g_closure_invalidate (meth->closure);
        g_closure_unref (meth->closure);
        g_free (meth);
    }
}
예제 #6
0
void _owr_data_channel_clear_closures(OwrDataChannel *data_channel)
{
    OwrDataChannelPrivate *priv = data_channel->priv;

    if (priv->on_datachannel_send) {
        g_closure_invalidate(priv->on_datachannel_send);
        g_closure_unref(priv->on_datachannel_send);
        priv->on_datachannel_send = NULL;
    }
    if (priv->on_request_bytes_sent) {
        g_closure_invalidate(priv->on_request_bytes_sent);
        g_closure_unref(priv->on_request_bytes_sent);
        priv->on_request_bytes_sent = NULL;
    }

    if (priv->on_datachannel_close) {
        g_closure_invalidate(priv->on_datachannel_close);
        g_closure_unref(priv->on_datachannel_close);
        priv->on_datachannel_close = NULL;
    }
}
예제 #7
0
/**
 * _owr_data_channel_set_on_request_bytes_sent:
 * @data_channel:
 * @on_request_bytes_sent: (transfer full):
 *
 */
void _owr_data_channel_set_on_request_bytes_sent(OwrDataChannel *data_channel,
        GClosure *on_request_bytes_sent)
{
    OwrDataChannelPrivate *priv = data_channel->priv;

    if (priv->on_request_bytes_sent) {
        g_closure_invalidate(priv->on_request_bytes_sent);
        g_closure_unref(priv->on_request_bytes_sent);
    }
    priv->on_request_bytes_sent = on_request_bytes_sent;

    if (on_request_bytes_sent)
        g_closure_set_marshal(priv->on_request_bytes_sent, g_cclosure_marshal_generic);
}
예제 #8
0
/**
 * _owr_data_channel_set_on_send:
 * @data_channel:
 * @on_datachannel_send: (transfer full):
 *
 */
void _owr_data_channel_set_on_send(OwrDataChannel *data_channel,
                                   GClosure *on_datachannel_send)
{
    OwrDataChannelPrivate *priv = data_channel->priv;

    if (priv->on_datachannel_send) {
        g_closure_invalidate(priv->on_datachannel_send);
        g_closure_unref(priv->on_datachannel_send);
    }
    priv->on_datachannel_send = on_datachannel_send;

    if (on_datachannel_send)
        g_closure_set_marshal(priv->on_datachannel_send, g_cclosure_marshal_generic);
}
예제 #9
0
파일: closure.cpp 프로젝트: smspillaz/gjs
static void
invalidate_js_pointers(Closure *c)
{
    if (c->obj == NULL)
        return;

    c->obj = NULL;
    c->context = NULL;
    c->runtime = NULL;

    /* Notify any closure reference holders they
     * may want to drop references.
     */
    g_closure_invalidate(&c->base);
}
예제 #10
0
void
g_closure_unref (GClosure *closure)
{
  g_return_if_fail (closure != NULL);
  g_return_if_fail (closure->ref_count > 0);

  if (closure->ref_count == 1)	/* last unref, invalidate first */
    g_closure_invalidate (closure);

  closure->ref_count -= 1;

  if (closure->ref_count == 0)
    {
      closure_invoke_notifiers (closure, FNOTIFY);
      g_free (closure->notifiers);
      g_free (closure);
    }
}
예제 #11
0
static void
e_soup_ssl_trust_message_finalized_cb (gpointer data,
				       GObject *unused_message)
{
	ESoupSslTrustData *handler;

	/* The network event handler will be disconnected from the message just
	 * before this is called. */
	handler = data;

	g_clear_object (&handler->source);

	/* Synchronously disconnects the accept certificate handler from all
	 * GTlsConnections. */
	g_closure_invalidate (handler->accept_certificate_closure);
	g_closure_unref (handler->accept_certificate_closure);

	g_free (handler);
}
예제 #12
0
/**
 * g_closure_unref:
 * @closure: #GClosure to decrement the reference count on
 *
 * Decrements the reference count of a closure after it was previously
 * incremented by the same caller. If no other callers are using the
 * closure, then the closure will be destroyed and freed.
 */
void
g_closure_unref (GClosure *closure)
{
  guint new_ref_count;

  g_return_if_fail (closure != NULL);
  g_return_if_fail (closure->ref_count > 0);

  if (closure->ref_count == 1)	/* last unref, invalidate first */
    g_closure_invalidate (closure);

  DEC_ASSIGN (closure, ref_count, &new_ref_count);

  if (new_ref_count == 0)
    {
      closure_invoke_notifiers (closure, FNOTIFY);
      g_free (closure->notifiers);
      g_free (closure);
    }
}
예제 #13
0
static void
free_accel_closures (GtkApplicationWindow *window)
{
  GSList *l;

  for (l = window->priv->accel_closures; l; l = l->next)
    {
       AccelClosure *closure = l->data;

       gtk_accel_group_disconnect (window->priv->accels, &closure->closure);

       g_object_unref (closure->closure.data);
       if (closure->parameter)
         g_variant_unref (closure->parameter);
       g_free (closure->action_name);
       g_closure_invalidate (&closure->closure);
       g_closure_unref (&closure->closure);
    }
  g_slist_free (window->priv->accel_closures);
  window->priv->accel_closures = NULL;
}
예제 #14
0
static void
rclosure_marshal(GClosure*       closure,
                 GValue*         return_value,
                 guint           n_param_values,
                 const GValue*   param_values,
                 gpointer        invocation_hint,
                 gpointer        marshal_data)
{
    struct marshal_arg arg;

    if (!rclosure_initialized) {
        g_closure_invalidate(closure);
        return;
    }

    arg.closure         = closure;
    arg.return_value    = return_value;
    arg.n_param_values  = n_param_values;
    arg.param_values    = param_values;
    arg.invocation_hint = invocation_hint;
    arg.marshal_data    = marshal_data;

    G_PROTECT_CALLBACK(rclosure_marshal_do, &arg);
}
예제 #15
0
 void frameDestroyed()
 {
     g_closure_invalidate(m_closure);
     FrameDestructionObserver::frameDestroyed();
 }