tracker r2439 - in trunk: . src/tracker-indexer
- From: carlosg svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2439 - in trunk: . src/tracker-indexer
- Date: Mon, 3 Nov 2008 17:44:27 +0000 (UTC)
Author: carlosg
Date: Mon Nov 3 17:44:27 2008
New Revision: 2439
URL: http://svn.gnome.org/viewvc/tracker?rev=2439&view=rev
Log:
2008-11-03 Carlos Garnacho <carlos imendio com>
* src/tracker-indexer/tracker-metadata-utils.c
(process_context_invalidate): Splitted invalidation from destruction.
So it's just the child watch handler the one responsible of destroying
it. This fixes a potential crash when the child watch is ron on an
already destroyed context.
(metadata_setup) (metadata_query_file): Just invalidate the metadata
context if it couldn't be created, the child watch will send it later
to the bin.
Modified:
trunk/ChangeLog
trunk/src/tracker-indexer/tracker-metadata-utils.c
Modified: trunk/src/tracker-indexer/tracker-metadata-utils.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-metadata-utils.c (original)
+++ trunk/src/tracker-indexer/tracker-metadata-utils.c Mon Nov 3 17:44:27 2008
@@ -70,23 +70,44 @@
static ProcessContext *metadata_context = NULL;
static void
-process_context_destroy (ProcessContext *context)
+process_context_invalidate (ProcessContext *context)
{
- g_io_channel_shutdown (context->stdin_channel, FALSE, NULL);
- g_io_channel_unref (context->stdin_channel);
+ if (context->stdin_channel) {
+ g_io_channel_shutdown (context->stdin_channel, FALSE, NULL);
+ g_io_channel_unref (context->stdin_channel);
+ context->stdin_channel = NULL;
+ }
- g_source_remove (context->stdout_watch_id);
- g_io_channel_shutdown (context->stdout_channel, FALSE, NULL);
- g_io_channel_unref (context->stdout_channel);
+ if (context->stdout_watch_id != 0) {
+ g_source_remove (context->stdout_watch_id);
+ context->stdout_watch_id = 0;
+ }
- if (g_main_loop_is_running (context->data_incoming_loop)) {
- g_main_loop_quit (context->data_incoming_loop);
+ if (context->stdout_channel) {
+ g_io_channel_shutdown (context->stdout_channel, FALSE, NULL);
+ g_io_channel_unref (context->stdout_channel);
+ context->stdout_channel = NULL;
}
- g_main_loop_unref (context->data_incoming_loop);
+ if (context->data_incoming_loop) {
+ if (g_main_loop_is_running (context->data_incoming_loop)) {
+ g_main_loop_quit (context->data_incoming_loop);
+ }
- g_spawn_close_pid (context->pid);
+ g_main_loop_unref (context->data_incoming_loop);
+ context->data_incoming_loop = NULL;
+ }
+ if (context->pid != 0) {
+ g_spawn_close_pid (context->pid);
+ context->pid = 0;
+ }
+}
+
+static void
+process_context_destroy (ProcessContext *context)
+{
+ process_context_invalidate (context);
g_free (context);
}
@@ -208,7 +229,7 @@
};
if (metadata_context) {
- process_context_destroy (metadata_context);
+ process_context_invalidate (metadata_context);
metadata_context = NULL;
}
@@ -271,7 +292,7 @@
if (status == G_IO_STATUS_ERROR) {
/* No point in trying again */
- process_context_destroy (metadata_context);
+ process_context_invalidate (metadata_context);
metadata_context = NULL;
g_free (str);
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]