Index: app/tools/gimptexttool.c
===================================================================
RCS file: /cvs/gnome/gimp/app/tools/gimptexttool.c,v
retrieving revision 1.234.2.3
diff -u -p -r1.234.2.3 gimptexttool.c
--- app/tools/gimptexttool.c	3 Aug 2004 14:33:17 -0000	1.234.2.3
+++ app/tools/gimptexttool.c	30 Oct 2004 19:28:35 -0000
@@ -690,12 +690,14 @@ gimp_text_tool_create_layer (GimpTextToo
   image = tool->gdisp->gimage;
   layer = gimp_text_layer_new (image, text);
 
-  g_object_unref (text);
-
   if (! layer)
-    return;
+    {
+      g_object_unref (text);
+      return;
+    }
 
   gimp_text_tool_connect (text_tool, GIMP_TEXT_LAYER (layer), text);
+  g_object_unref (text);
 
   gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TEXT,
                                _("Add Text Layer"));
