From 645f6e47ea513495f428f9299c5e4ec89dac9891 Mon Sep 17 00:00:00 2001 From: Morten Welinder Date: Mon, 18 Sep 2000 02:26:00 +0000 Subject: Leak prevention. 2000-09-17 Morten Welinder * src/widgets/e-colors.c (e_color_init): Don't leak if called twice. svn path=/trunk/; revision=5489 --- widgets/misc/e-colors.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/widgets/misc/e-colors.c b/widgets/misc/e-colors.c index 4154b1bf3d..c7a79003ae 100644 --- a/widgets/misc/e-colors.c +++ b/widgets/misc/e-colors.c @@ -60,8 +60,14 @@ e_color_alloc_name (const char *name, GdkColor *c) void e_color_init (void) { - GdkColormap *colormap = gtk_widget_get_default_colormap (); - + GdkColormap *colormap; + + /* It's surprisingly easy to end up calling this twice. Survive. */ + if (e_color_inited) + return; + + colormap = gtk_widget_get_default_colormap (); + /* Initialize the color context */ e_color_context = gdk_color_context_new ( gtk_widget_get_default_visual (), colormap); -- cgit