示例#1
0
/* Asserts that all files in @included are also in @including */
static void
scan_directory (GFile *directory,
                FileScannedCallback scanned_callback,
                gpointer callback_data)
{
  GQueue *files;
  GQueue *file_infos;
  GFileEnumerator *enumerator;

  files = g_queue_new ();
  file_infos = g_queue_new ();

  g_queue_push_tail (files, g_object_ref (directory));
  g_queue_push_tail (file_infos,
                     g_file_query_info (directory,
                                        G_FILE_ATTRIBUTE_STANDARD_NAME","
                                        G_FILE_ATTRIBUTE_STANDARD_TYPE,
                                        G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
                                        NULL, NULL));

  while (!g_queue_is_empty (files)) {
    g_autoptr (GFile) file;
    g_autoptr (GFileInfo) file_info;

    file = g_queue_pop_tail (files);
    file_info = g_queue_pop_tail (file_infos);

    if (scanned_callback) {
      scanned_callback (file, file_info, callback_data);
    }

    if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY) {
      enumerator = g_file_enumerate_children (file,
                                              G_FILE_ATTRIBUTE_STANDARD_NAME","
                                              G_FILE_ATTRIBUTE_STANDARD_TYPE,
                                              G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
                                              NULL, NULL);

      if (enumerator) {
        GFile *child;
        GFileInfo *child_info;

        child_info = g_file_enumerator_next_file (enumerator, NULL, NULL);
        while (child_info != NULL) {
          child = g_file_get_child (file, g_file_info_get_name (child_info));

          g_queue_push_tail (files, child);
          g_queue_push_tail (file_infos, child_info);

          child_info = g_file_enumerator_next_file (enumerator, NULL, NULL);
        }

        g_object_unref (enumerator);
      }
    }
  }

  g_queue_free_full (files, g_object_unref);
  g_queue_free_full (file_infos, g_object_unref);
}
示例#2
0
文件: dunst.c 项目: berkley4/dunst
static void teardown(void)
{
        regex_teardown();

        g_queue_free_full(history, teardown_notification);
        g_queue_free_full(displayed, teardown_notification);
        g_queue_free_full(queue, teardown_notification);

        x_free();
}
示例#3
0
static void
impl_finalize (GObject *object)
{
	RhythmDBImportJob *job = RHYTHMDB_IMPORT_JOB (object);

	g_queue_free_full (job->priv->outstanding, g_free);
	g_queue_free_full (job->priv->processing, g_free);

	rb_slist_deep_free (job->priv->uri_list);

	g_free (job->priv->task_label);

	G_OBJECT_CLASS (rhythmdb_import_job_parent_class)->finalize (object);
}
示例#4
0
static GVariant *
dconf_settings_backend_read (GSettingsBackend   *backend,
                             const gchar        *key,
                             const GVariantType *expected_type,
                             gboolean            default_value)
{
  DConfSettingsBackend *dcsb = (DConfSettingsBackend *) backend;
  GVariant *value;

  if (default_value)
    {
      GQueue *read_through;

      /* Mark the key as having been reset when trying to do the read... */
      read_through = g_queue_new ();
      g_queue_push_tail (read_through, dconf_changeset_new_write (key, NULL));
      value = dconf_engine_read (dcsb->engine, read_through, key);
      g_queue_free_full (read_through, (GDestroyNotify) dconf_changeset_unref);
    }

  else
    value = dconf_engine_read (dcsb->engine, NULL, key);

  return value;
}
示例#5
0
static void
on_channel_closed (CockpitChannel *local,
                   const gchar *problem,
                   gpointer user_data)
{
  CockpitRouter *self = COCKPIT_ROUTER (user_data);
  const gchar *channel;
  GQueue *fenced;
  GList *l;

  channel = cockpit_channel_get_id (local);
  g_hash_table_remove (self->channels, channel);
  g_hash_table_remove (self->groups, channel);

  /*
   * If this was the last channel in the fence group then resume all other channels
   * as there's no barrier preventing them from functioning.
   */
  if (!g_hash_table_remove (self->fences, channel) || g_hash_table_size (self->fences) != 0)
    return;

  fenced = self->fenced;
  self->fenced = NULL;

  if (!fenced)
    return;

  for (l = fenced->head; l != NULL; l = g_list_next (l))
    cockpit_transport_thaw (self->transport, l->data);
  g_queue_free_full (fenced, g_free);
}
示例#6
0
static void
resolve_closure_free (ResolveClosure *closure)
{
  g_object_unref (closure->self);
  g_queue_free_full (closure->pending_requests, pending_request_free);
  g_hash_table_destroy (closure->keys);
  g_slice_free (ResolveClosure, closure);
}
示例#7
0
static GstFlowReturn
gst_vtdec_decode_buffer (GstVTDec * self, GstBuffer * buf)
{
  GstVTApi *vt = self->ctx->vt;
  CMSampleBufferRef sbuf;
  VTStatus status;
  VTDecodeFrameFlags frame_flags = 0;
  GstFlowReturn ret = GST_FLOW_OK;

  sbuf = gst_vtdec_sample_buffer_from (self, buf);

  self->flush = FALSE;
  status = vt->VTDecompressionSessionDecodeFrame (self->session, sbuf,
      frame_flags, buf, NULL);
  if (status != 0) {
    GST_WARNING_OBJECT (self, "VTDecompressionSessionDecodeFrame returned %d",
        status);
  }

  status = vt->VTDecompressionSessionWaitForAsynchronousFrames (self->session);
  if (status != 0) {
    GST_WARNING_OBJECT (self,
        "VTDecompressionSessionWaitForAsynchronousFrames returned %d", status);
  }

  CFRelease (sbuf);
  gst_buffer_unref (buf);

  if (self->flush) {
    if (!gst_vtdec_negotiate_downstream (self)) {
      ret = GST_FLOW_NOT_NEGOTIATED;
      goto error;
    }

    g_queue_sort (self->cur_outbufs, (GCompareDataFunc) _sort_buffers, NULL);
    while (!g_queue_is_empty (self->cur_outbufs)) {
      buf = g_queue_pop_head (self->cur_outbufs);
      GST_LOG_OBJECT (self, "Pushing buffer with PTS:%" GST_TIME_FORMAT,
          GST_TIME_ARGS (GST_BUFFER_PTS (buf)));
      ret = gst_pad_push (self->srcpad, buf);
      if (ret != GST_FLOW_OK) {
        goto error;
      }
    }
  };

exit:
  return ret;

error:
  {
    g_queue_free_full (self->cur_outbufs, (GDestroyNotify) gst_buffer_unref);
    self->cur_outbufs = g_queue_new ();
    goto exit;
  }
}
示例#8
0
static void file_op_data_destroy (DirTreeFileOpData *op_data)
{
    LOG_debug (DIR_TREE_LOG, "Destroying opdata !");

    if (g_queue_get_length (op_data->q_ranges_requested) > 0)
        g_queue_free_full (op_data->q_ranges_requested, g_free);
    else
        g_queue_free (op_data->q_ranges_requested);
    g_free (op_data);
}
static void
ephy_session_dispose (GObject *object)
{
	EphySession *session = EPHY_SESSION (object);

	LOG ("EphySession disposing");

	g_queue_free_full (session->priv->closed_tabs,
			   (GDestroyNotify)closed_tab_free);

	G_OBJECT_CLASS (ephy_session_parent_class)->dispose (object);
}
示例#10
0
static void
cockpit_web_response_finalize (GObject *object)
{
  CockpitWebResponse *self = COCKPIT_WEB_RESPONSE (object);

  g_free (self->path);
  g_assert (self->io == NULL);
  g_assert (self->out == NULL);
  g_queue_free_full (self->queue, (GDestroyNotify)g_bytes_unref);

  G_OBJECT_CLASS (cockpit_web_response_parent_class)->finalize (object);
}
示例#11
0
void
gst_buffer_queue_flush (GstBufferQueue * queue)
{
  if (queue->queue == NULL)
    return;
  g_mutex_lock (&queue->lock);
  queue->running = FALSE;
  g_cond_signal (&queue->cond);
  g_queue_free_full (queue->queue, (GDestroyNotify)gst_buffer_unref);
  queue->queue = NULL;
  g_mutex_unlock (&queue->lock);
}
示例#12
0
static void
gum_duk_debug_session_weak_notify (GumDukDebugSession * self,
                                   GObject * where_the_object_was)
{
  g_object_unref (self->channel);

  g_queue_free_full (self->outgoing, (GDestroyNotify) g_bytes_unref);

  g_io_stream_close_async (self->stream, G_PRIORITY_LOW, NULL, NULL, NULL);
  g_object_unref (self->stream);

  g_slice_free (GumDukDebugSession, self);
}
static void
soup_cache_input_stream_finalize (GObject *object)
{
	SoupCacheInputStream *self = (SoupCacheInputStream *)object;
	SoupCacheInputStreamPrivate *priv = self->priv;

	g_clear_object (&priv->cancellable);
	g_clear_object (&priv->output_stream);
	g_clear_pointer (&priv->current_writing_buffer, soup_buffer_free);
	g_queue_free_full (priv->buffer_queue, (GDestroyNotify) soup_buffer_free);

	G_OBJECT_CLASS (soup_cache_input_stream_parent_class)->finalize (object);
}
static void
provider_info_free (gpointer data)
{
	ProviderInfo *info = data;

	if (data == NULL)
	{
		return;
	}

	g_object_unref (info->completion_provider);
	g_queue_free_full (info->proposals, (GDestroyNotify)proposal_info_free);
	g_slice_free (ProviderInfo, data);
}
static void
gb_shortcuts_dialog_custom_finished (GtkBuildable *buildable,
                                     GtkBuilder   *builder,
                                     GObject      *child,
                                     const gchar  *tagname,
                                     gpointer      user_data)
{
  g_assert (GB_IS_SHORTCUTS_DIALOG (buildable));
  g_assert (GTK_IS_BUILDER (builder));
  g_assert (tagname != NULL);

  if (g_strcmp0 (tagname, "views") == 0)
    {
      ViewsParserData *parser_data = user_data;

      g_object_unref (parser_data->self);
      g_object_unref (parser_data->builder);
      g_queue_free_full (parser_data->stack, (GDestroyNotify)g_object_unref);
      g_queue_free_full (parser_data->column_image_size_groups, (GDestroyNotify)g_object_unref);
      g_queue_free_full (parser_data->column_desc_size_groups, (GDestroyNotify)g_object_unref);
      g_slice_free (ViewsParserData, parser_data);
    }
}
示例#16
0
void process_free(Process* proc) {
    MAGIC_ASSERT(proc);

    process_stop(proc);

    g_string_free(proc->arguments, TRUE);

    if(proc->atExitFunctions) {
        g_queue_free_full(proc->atExitFunctions, g_free);
    }

    MAGIC_CLEAR(proc);
    g_free(proc);
}
示例#17
0
void
listbox_remove_list (WListbox * l)
{
    if (l != NULL)
    {
        if (l->list != NULL)
        {
            g_queue_free_full (l->list, (GDestroyNotify) listbox_entry_free);
            l->list = NULL;
        }

        l->pos = l->top = 0;
    }
}
示例#18
0
void
cometd_inbox_destroy(cometd_inbox* inbox)
{
  g_mutex_lock(inbox->m);
  g_queue_free_full(inbox->queue, (GDestroyNotify) json_node_free);
  g_mutex_unlock(inbox->m);

  inbox->loop = NULL;
  g_cond_clear(inbox->c);
  free(inbox->c);
  g_mutex_clear(inbox->m);
  free(inbox->m);
  free(inbox);
}
示例#19
0
void
http_put_destroy(struct http_put_s *p)
{
	if (!p)
		return;
	if (p->dests)
		g_slist_free_full(p->dests, http_put_dest_destroy);
	if (p->mhandle)
		curl_multi_cleanup(p->mhandle);
	if (p->buffer_tail) {
		g_queue_free_full(p->buffer_tail, (GDestroyNotify)g_bytes_unref);
		p->buffer_tail = NULL;
	}
	g_free(p);
}
示例#20
0
void rm_file_destroy(RmFile *file) {
    if(file->disk_offsets) {
        g_sequence_free(file->disk_offsets);
    }
    if(file->hardlinks.is_head && file->hardlinks.files) {
        g_queue_free_full(file->hardlinks.files, (GDestroyNotify)rm_file_destroy);
    }

    /* --cache can write cksums in here */
    if(file->folder && file->folder->data) {
        g_free(file->folder->data);
    }

    g_slice_free(RmFile, file);
}
示例#21
0
void s3client_pool_destroy (S3ClientPool *pool)
{
    GList *l;
    PoolClient *pc;

    g_queue_free_full (pool->q_requests, g_free);
    for (l = g_list_first (pool->l_clients); l; l = g_list_next (l)) {
        pc = (PoolClient *) l->data;
        pc->client_destroy (pc->client);
        g_free (pc);
    }
    g_list_free (pool->l_clients);

    g_free (pool);
}
示例#22
0
static void
empathy_roster_view_finalize (GObject *object)
{
  EmpathyRosterView *self = EMPATHY_ROSTER_VIEW (object);
  void (*chain_up) (GObject *) =
      ((GObjectClass *) empathy_roster_view_parent_class)->finalize;

  g_hash_table_unref (self->priv->roster_contacts);
  g_hash_table_unref (self->priv->roster_groups);
  g_hash_table_unref (self->priv->displayed_contacts);
  g_queue_free_full (self->priv->events, event_free);

  if (chain_up != NULL)
    chain_up (object);
}
示例#23
0
static void
gom_application_dispose (GObject *object)
{
  GomApplication *self = GOM_APPLICATION (object);

  g_clear_object (&self->cancellable);
  g_clear_object (&self->miner);
  g_clear_object (&self->skeleton);

  if (self->queue != NULL)
    {
      g_queue_free_full (self->queue, g_object_unref);
      self->queue = NULL;
    }

  G_OBJECT_CLASS (gom_application_parent_class)->dispose (object);
}
示例#24
0
void server_destroy(server *s)
{
	if (!s) return;

	server_close(s);

	g_queue_free_full(s->free_connections, server_destroy_connection);
	s->free_connections = NULL;

	if (s->connections) g_list_free_full(s->connections, server_destroy_connection);
	s->connections = NULL;

	fclose(s->log_file);
	s->log_file = NULL;

	free(s);
}
示例#25
0
static void
cockpit_channel_dispose (GObject *object)
{
  CockpitChannel *self = COCKPIT_CHANNEL (object);

  /*
   * This object was destroyed before going to the main loop
   * no need to wait until later before we fire various signals.
   */
  if (self->priv->prepare_tag)
    {
      g_source_remove (self->priv->prepare_tag);
      self->priv->prepare_tag = 0;
    }

  if (self->priv->recv_sig)
    g_signal_handler_disconnect (self->priv->transport, self->priv->recv_sig);
  self->priv->recv_sig = 0;

  if (self->priv->control_sig)
    g_signal_handler_disconnect (self->priv->transport, self->priv->control_sig);
  self->priv->control_sig = 0;

  if (self->priv->close_sig)
    g_signal_handler_disconnect (self->priv->transport, self->priv->close_sig);
  self->priv->close_sig = 0;

  if (!self->priv->emitted_close)
    cockpit_channel_close (self, "terminated");

  if (self->priv->buffer_timeout)
    g_source_remove(self->priv->buffer_timeout);
  self->priv->buffer_timeout = 0;

  if (self->priv->out_buffer)
    g_bytes_unref (self->priv->out_buffer);
  self->priv->out_buffer = NULL;

  cockpit_flow_throttle (COCKPIT_FLOW (self), NULL);
  g_assert (self->priv->pressure == NULL);
  if (self->priv->throttled)
    g_queue_free_full (self->priv->throttled, (GDestroyNotify)json_object_unref);
  self->priv->throttled = NULL;

  G_OBJECT_CLASS (cockpit_channel_parent_class)->dispose (object);
}
示例#26
0
static void
cockpit_router_finalize (GObject *object)
{
  CockpitRouter *self = COCKPIT_ROUTER (object);

  if (self->transport)
    g_object_unref (self->transport);

  if (self->fenced)
    g_queue_free_full (self->fenced, g_free);

  g_free (self->init_host);
  g_hash_table_destroy (self->channels);
  g_hash_table_destroy (self->groups);
  g_hash_table_destroy (self->fences);

  G_OBJECT_CLASS (cockpit_router_parent_class)->finalize (object);
}
示例#27
0
TEST_F(GQueueTest, freeFull)
{
	int testData1 = 42;
	int testData2 = 1337;

	GList *list = NULL;
	list = g_list_append(list, &testData1);
	list = g_list_append(list, &testData2);
	queue->head = list;
	queue->tail = list->next;
	queue->length = 2;

	g_queue_free_full(queue, test_free_callback);
	std::vector<gpointer> expectedCallbacks = {&testData1, &testData2};
	ASSERT_EQ(expectedCallbacks, freeCallbacks) << "actual callback list should match expected";

	queue = NULL;
}
示例#28
0
static void
cockpit_ssh_transport_finalize (GObject *object)
{
  CockpitSshTransport *self = COCKPIT_SSH_TRANSPORT (object);

  /* libssh channels like to hang around even after they're freed */
  memset (&self->channel_cbs, 0, sizeof (self->channel_cbs));
  ssh_event_free (self->event);

  cockpit_ssh_data_free (self->data);
  g_free (self->logname);

  g_queue_free_full (self->queue, (GDestroyNotify)g_bytes_unref);
  g_byte_array_free (self->buffer, TRUE);

  g_assert (self->io == NULL);

  G_OBJECT_CLASS (cockpit_ssh_transport_parent_class)->finalize (object);
}
示例#29
0
static void
spice_vdagent_finalize(GObject *gobject)
{
    SpiceVDAgent *self = SPICE_VDAGENT(gobject);

    g_signal_handlers_disconnect_by_data(gdk_screen_get_default(), self);

    g_clear_object(&self->connection);
#ifdef G_OS_UNIX
    g_clear_object(&self->connectable);
    g_clear_object(&self->socket);
#endif

    g_free(self->data);
    g_queue_free_full(self->outq, g_free);

    if (G_OBJECT_CLASS(spice_vdagent_parent_class)->finalize)
        G_OBJECT_CLASS(spice_vdagent_parent_class)->finalize(gobject);
}
示例#30
0
/**
 * gs_shell_dispose:
 **/
static void
gs_shell_dispose (GObject *object)
{
	GsShell *shell = GS_SHELL (object);
	GsShellPrivate *priv = gs_shell_get_instance_private (shell);

	if (priv->back_entry_stack != NULL) {
		g_queue_free_full (priv->back_entry_stack, (GDestroyNotify) free_back_entry);
		priv->back_entry_stack = NULL;
	}
	g_clear_object (&priv->builder);
	g_clear_object (&priv->cancellable);
	g_clear_object (&priv->plugin_loader);
	g_clear_object (&priv->header_start_widget);
	g_clear_object (&priv->header_end_widget);
	g_clear_pointer (&priv->modal_dialogs, (GDestroyNotify) g_ptr_array_unref);

	G_OBJECT_CLASS (gs_shell_parent_class)->dispose (object);
}