chiark / gitweb /
Disable use of libgc on libglib and descendants. I believe that
authorrjk@greenend.org.uk <>
Sat, 7 Jul 2007 14:30:48 +0000 (15:30 +0100)
committerrjk@greenend.org.uk <>
Sat, 7 Jul 2007 14:30:48 +0000 (15:30 +0100)
somewhere the latter is still allocating memory outside of libgc's
ability to detect it, but I cannot determine where.

GtkScale format-value callbacks fixed to use g_strdup().

.bzrignore
disobedience/control.c
disobedience/disobedience.c

index 5b9a5249da419ba939469fda7e4bbd4602bf61f0..b183b9f020c89e0d8a4a2a8b7df3d1fd2e844ab8 100644 (file)
@@ -87,3 +87,4 @@ templates/Makefile
 doc/disorder-speaker.8.html
 .gdb_history
 core
+vgcore.*
index 776aff1232ea18c00244c96ab8cdc648574ccf3e..197e244957366502b2ad4241178efaa6d21231ac 100644 (file)
@@ -233,7 +233,7 @@ static gchar *format_volume(GtkScale attribute((unused)) *scale,
   char s[32];
 
   snprintf(s, sizeof s, "%.1f", (double)value);
-  return xstrdup(s);
+  return g_strdup(s);
 }
 
 /* Called to format the balance value. */
@@ -242,9 +242,9 @@ static gchar *format_balance(GtkScale attribute((unused)) *scale,
   char s[32];
 
   if(fabs(value) < 0.1)
-    return xstrdup("0");
+    return g_strdup("0");
   snprintf(s, sizeof s, "%+.1f", (double)value);
-  return xstrdup(s);
+  return g_strdup(s);
 }
 
 /* Volume mapping.  We consider left, right, volume to be in [0,1]
index 28eeeff4c722856d9286574ee0d41c15fec37edb..49560fb52b45f78f288e855f89c512afe47e5345 100644 (file)
@@ -58,15 +58,6 @@ int volume_l, volume_r;                 /* volume */
 double goesupto = 10;                   /* volume upper bound */
 int choosealpha;                        /* break up choose by letter */
 
-static const GMemVTable glib_memvtable = {
-  xmalloc,
-  xrealloc,
-  xfree,
-  0,                                    /* calloc */
-  0,                                    /* try_malloc */
-  0                                     /* try_realloc */
-};
-
 static const disorder_eclient_log_callbacks gdisorder_log_callbacks = {
   log_connected,
   log_completed,
@@ -331,12 +322,6 @@ int main(int argc, char **argv) {
   mem_init(1);
   if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale");
   /* Causes GTK+ to 0-fill lots of things, which helps the garbage collector. */
-  g_mem_gc_friendly = 1;
-  /* Causes GTK+ to always use g_malloc() instead of private allocator that
-   * libgc doesn't know about */
-  g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, 1);
-  /* GLib sucks - not const-correct */
-  g_mem_set_vtable((GMemVTable *)&glib_memvtable);
   gtk_init(&argc, &argv);
   gtk_rc_parse_string(style);
   while((n = getopt_long(argc, argv, "hVc:dtH", options, 0)) >= 0) {