+2002-03-14 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * glib/gmessages.c: Fixed threading issues brought up by
+ #74577. Make g_log_find_domain, g_log_domain_new,
+ g_log_domain_check_free and g_log_domain_get_handler require being
+ called with g_messages_lock held and remove all internal locking
+ in them. Then added proper locking to g_log_set_handler,
+ g_log_remove_handler and g_logv. Problem spotted by Miroslaw
+ Dobrzanski-Neumann <mne@mosaic-ag.com>. (#74577)
+
2002-03-13 Erwann Chenede <erwann.chenede@sun.com>
* glib/gconvert.c
glib/gen-unicode-tables.pl
+2002-03-14 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * glib/gmessages.c: Fixed threading issues brought up by
+ #74577. Make g_log_find_domain, g_log_domain_new,
+ g_log_domain_check_free and g_log_domain_get_handler require being
+ called with g_messages_lock held and remove all internal locking
+ in them. Then added proper locking to g_log_set_handler,
+ g_log_remove_handler and g_logv. Problem spotted by Miroslaw
+ Dobrzanski-Neumann <mne@mosaic-ag.com>. (#74577)
+
2002-03-13 Erwann Chenede <erwann.chenede@sun.com>
* glib/gconvert.c
glib/gen-unicode-tables.pl
+2002-03-14 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * glib/gmessages.c: Fixed threading issues brought up by
+ #74577. Make g_log_find_domain, g_log_domain_new,
+ g_log_domain_check_free and g_log_domain_get_handler require being
+ called with g_messages_lock held and remove all internal locking
+ in them. Then added proper locking to g_log_set_handler,
+ g_log_remove_handler and g_logv. Problem spotted by Miroslaw
+ Dobrzanski-Neumann <mne@mosaic-ag.com>. (#74577)
+
2002-03-13 Erwann Chenede <erwann.chenede@sun.com>
* glib/gconvert.c
glib/gen-unicode-tables.pl
+2002-03-14 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * glib/gmessages.c: Fixed threading issues brought up by
+ #74577. Make g_log_find_domain, g_log_domain_new,
+ g_log_domain_check_free and g_log_domain_get_handler require being
+ called with g_messages_lock held and remove all internal locking
+ in them. Then added proper locking to g_log_set_handler,
+ g_log_remove_handler and g_logv. Problem spotted by Miroslaw
+ Dobrzanski-Neumann <mne@mosaic-ag.com>. (#74577)
+
2002-03-13 Erwann Chenede <erwann.chenede@sun.com>
* glib/gconvert.c
glib/gen-unicode-tables.pl
+2002-03-14 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * glib/gmessages.c: Fixed threading issues brought up by
+ #74577. Make g_log_find_domain, g_log_domain_new,
+ g_log_domain_check_free and g_log_domain_get_handler require being
+ called with g_messages_lock held and remove all internal locking
+ in them. Then added proper locking to g_log_set_handler,
+ g_log_remove_handler and g_logv. Problem spotted by Miroslaw
+ Dobrzanski-Neumann <mne@mosaic-ag.com>. (#74577)
+
2002-03-13 Erwann Chenede <erwann.chenede@sun.com>
* glib/gconvert.c
glib/gen-unicode-tables.pl
+2002-03-14 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * glib/gmessages.c: Fixed threading issues brought up by
+ #74577. Make g_log_find_domain, g_log_domain_new,
+ g_log_domain_check_free and g_log_domain_get_handler require being
+ called with g_messages_lock held and remove all internal locking
+ in them. Then added proper locking to g_log_set_handler,
+ g_log_remove_handler and g_logv. Problem spotted by Miroslaw
+ Dobrzanski-Neumann <mne@mosaic-ag.com>. (#74577)
+
2002-03-13 Erwann Chenede <erwann.chenede@sun.com>
* glib/gconvert.c
glib/gen-unicode-tables.pl
+2002-03-14 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * glib/gmessages.c: Fixed threading issues brought up by
+ #74577. Make g_log_find_domain, g_log_domain_new,
+ g_log_domain_check_free and g_log_domain_get_handler require being
+ called with g_messages_lock held and remove all internal locking
+ in them. Then added proper locking to g_log_set_handler,
+ g_log_remove_handler and g_logv. Problem spotted by Miroslaw
+ Dobrzanski-Neumann <mne@mosaic-ag.com>. (#74577)
+
2002-03-13 Erwann Chenede <erwann.chenede@sun.com>
* glib/gconvert.c
glib/gen-unicode-tables.pl
+2002-03-14 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * glib/gmessages.c: Fixed threading issues brought up by
+ #74577. Make g_log_find_domain, g_log_domain_new,
+ g_log_domain_check_free and g_log_domain_get_handler require being
+ called with g_messages_lock held and remove all internal locking
+ in them. Then added proper locking to g_log_set_handler,
+ g_log_remove_handler and g_logv. Problem spotted by Miroslaw
+ Dobrzanski-Neumann <mne@mosaic-ag.com>. (#74577)
+
2002-03-13 Erwann Chenede <erwann.chenede@sun.com>
* glib/gconvert.c
glib/gen-unicode-tables.pl
}
}
+/* HOLDS g_messages_lock */
static inline GLogDomain*
g_log_find_domain (const gchar *log_domain)
{
register GLogDomain *domain;
- g_mutex_lock (g_messages_lock);
domain = g_log_domains;
while (domain)
{
if (strcmp (domain->log_domain, log_domain) == 0)
- {
- g_mutex_unlock (g_messages_lock);
- return domain;
- }
+ return domain;
domain = domain->next;
}
- g_mutex_unlock (g_messages_lock);
return NULL;
}
+/* HOLDS g_messages_lock */
static inline GLogDomain*
g_log_domain_new (const gchar *log_domain)
{
domain->fatal_mask = G_LOG_FATAL_MASK;
domain->handlers = NULL;
- g_mutex_lock (g_messages_lock);
domain->next = g_log_domains;
g_log_domains = domain;
- g_mutex_unlock (g_messages_lock);
return domain;
}
+/* HOLDS g_messages_lock */
static inline void
g_log_domain_check_free (GLogDomain *domain)
{
last = NULL;
- g_mutex_lock (g_messages_lock);
work = g_log_domains;
while (work)
{
last = work;
work = last->next;
}
- g_mutex_unlock (g_messages_lock);
}
}
+/* HOLDS g_messages_lock */
static inline GLogFunc
g_log_domain_get_handler (GLogDomain *domain,
GLogLevelFlags log_level,
/* remove bogus flag */
fatal_mask &= ~G_LOG_FLAG_FATAL;
+ g_mutex_lock (g_messages_lock);
+
domain = g_log_find_domain (log_domain);
if (!domain)
domain = g_log_domain_new (log_domain);
domain->fatal_mask = fatal_mask;
g_log_domain_check_free (domain);
-
+
+ g_mutex_unlock (g_messages_lock);
+
return old_flags;
}
if (!log_domain)
log_domain = "";
+ g_mutex_lock (g_messages_lock);
+
domain = g_log_find_domain (log_domain);
if (!domain)
domain = g_log_domain_new (log_domain);
handler = g_new (GLogHandler, 1);
- g_mutex_lock (g_messages_lock);
handler->id = ++handler_id;
- g_mutex_unlock (g_messages_lock);
handler->log_level = log_levels;
handler->log_func = log_func;
handler->data = user_data;
handler->next = domain->handlers;
domain->handlers = handler;
+
+ g_mutex_unlock (g_messages_lock);
return handler_id;
}
if (!log_domain)
log_domain = "";
+ g_mutex_lock (g_messages_lock);
+
domain = g_log_find_domain (log_domain);
if (domain)
{
else
domain->handlers = work->next;
g_free (work);
- g_log_domain_check_free (domain);
+ g_log_domain_check_free (domain);
+
+ g_mutex_unlock (g_messages_lock);
return;
}
last = work;
work = last->next;
}
- }
+ }
+
+ g_mutex_unlock (g_messages_lock);
g_warning ("g_log_remove_handler(): could not find handler with id `%d' for domain \"%s\"",
handler_id,
log_domain);
GLogFunc log_func;
gpointer data = NULL;
+ g_mutex_lock (g_messages_lock);
+
domain = g_log_find_domain (log_domain ? log_domain : "");
if (depth)
depth++;
g_private_set (g_log_depth, GUINT_TO_POINTER (depth));
-
- g_mutex_lock (g_messages_lock);
+
if ((((domain ? domain->fatal_mask : G_LOG_FATAL_MASK) |
g_log_always_fatal) & test_level) != 0)
test_level |= G_LOG_FLAG_FATAL;
- g_mutex_unlock (g_messages_lock);
log_func = g_log_domain_get_handler (domain, test_level, &data);
+ g_mutex_unlock (g_messages_lock);
+
log_func (log_domain, test_level, buffer, data);
/* *domain can be cluttered now */