From 648ed6853c2c7dd6e94af0db1a3d6c1b92643a73 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Sun, 30 Oct 2005 01:16:43 +0000 Subject: [PATCH] 2005-10-29 Jim Evins * src/glabels.c: (main): * src/label-barcode.c: (gl_label_barcode_finalize): * src/label-text.c: (gl_label_text_finalize), (set_font_family): * src/label.c: (gl_label_instance_init), (gl_label_finalize): * src/object-editor.c: (gl_object_editor_finalize): Another pass at valgrinding -- plugged several memory leaks. * src/view-text.c: (gl_view_text_new), (update_canvas_item_from_object_cb), (draw_hacktext): Commented out artifacts of edit-in-place code. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@560 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/ChangeLog | 12 ++++++++++++ glabels2/src/glabels.c | 4 +++- glabels2/src/label-barcode.c | 3 ++- glabels2/src/label-text.c | 4 +++- glabels2/src/label.c | 9 +++++---- glabels2/src/object-editor.c | 4 ++++ glabels2/src/view-text.c | 13 ++++++++++++- 7 files changed, 41 insertions(+), 8 deletions(-) diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index 60750ccd..f5756127 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,15 @@ +2005-10-29 Jim Evins + + * src/glabels.c: (main): + * src/label-barcode.c: (gl_label_barcode_finalize): + * src/label-text.c: (gl_label_text_finalize), (set_font_family): + * src/label.c: (gl_label_instance_init), (gl_label_finalize): + * src/object-editor.c: (gl_object_editor_finalize): + Another pass at valgrinding -- plugged several memory leaks. + * src/view-text.c: (gl_view_text_new), + (update_canvas_item_from_object_cb), (draw_hacktext): + Commented out artifacts of edit-in-place code. + 2005-10-28 Jim Evins * src/canvas-hacktext.c: (gl_canvas_hacktext_set_arg): diff --git a/glabels2/src/glabels.c b/glabels2/src/glabels.c index 01fe8186..8cb329d3 100644 --- a/glabels2/src/glabels.c +++ b/glabels2/src/glabels.c @@ -153,7 +153,9 @@ main (int argc, char **argv) /* Begin main loop */ gtk_main(); - + + g_object_unref (G_OBJECT (program)); + return 0; } diff --git a/glabels2/src/label-barcode.c b/glabels2/src/label-barcode.c index 9ec54c97..805d6b57 100644 --- a/glabels2/src/label-barcode.c +++ b/glabels2/src/label-barcode.c @@ -138,8 +138,9 @@ gl_label_barcode_finalize (GObject *object) lbc = GL_LABEL_BARCODE (object); - gl_color_node_free (&(lbc->private->color_node)); gl_text_node_free (&lbc->private->text_node); + g_free (lbc->private->id); + gl_color_node_free (&(lbc->private->color_node)); g_free (lbc->private); G_OBJECT_CLASS (parent_class)->finalize (object); diff --git a/glabels2/src/label-text.c b/glabels2/src/label-text.c index 9d4cdd29..fd8da7e1 100644 --- a/glabels2/src/label-text.c +++ b/glabels2/src/label-text.c @@ -212,9 +212,10 @@ gl_label_text_finalize (GObject *object) ltext = GL_LABEL_TEXT (object); - gl_color_node_free (&(ltext->private->color_node)); g_object_unref (ltext->private->tag_table); g_object_unref (ltext->private->buffer); + g_free (ltext->private->font_family); + gl_color_node_free (&(ltext->private->color_node)); g_free (ltext->private); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -449,6 +450,7 @@ set_font_family (glLabelObject *object, if (ltext->private->font_family) { if (g_strcasecmp (ltext->private->font_family, good_font_family) == 0) { + g_free (good_font_family); gl_debug (DEBUG_LABEL, "END (no change)"); return; } diff --git a/glabels2/src/label.c b/glabels2/src/label.c index 2497ab23..e80c0a17 100644 --- a/glabels2/src/label.c +++ b/glabels2/src/label.c @@ -185,7 +185,9 @@ gl_label_instance_init (glLabel *label) gl_debug (DEBUG_LABEL, "START"); label->private = g_new0 (glLabelPrivate, 1); - label->private->merge = NULL; + label->private->template = NULL; + label->private->filename = NULL; + label->private->merge = NULL; label->private->pixbuf_cache = gl_pixbuf_cache_new (); gl_debug (DEBUG_LABEL, "END"); @@ -203,17 +205,16 @@ gl_label_finalize (GObject *object) label = GL_LABEL (object); - gl_template_free (label->private->template); - for (p = label->objects; p != NULL; p = p_next) { p_next = p->next; /* NOTE: p will be left dangling */ g_object_unref (G_OBJECT(p->data)); } + gl_template_free (label->private->template); + g_free (label->private->filename); if (label->private->merge != NULL) { g_object_unref (G_OBJECT(label->private->merge)); } - gl_pixbuf_cache_free (label->private->pixbuf_cache); g_free (label->private); diff --git a/glabels2/src/object-editor.c b/glabels2/src/object-editor.c index d9eb2989..3b2cf9ba 100644 --- a/glabels2/src/object-editor.c +++ b/glabels2/src/object-editor.c @@ -192,6 +192,10 @@ gl_object_editor_finalize (GObject *object) g_return_if_fail (GL_IS_OBJECT_EDITOR (editor)); g_return_if_fail (editor->priv != NULL); + if (editor->priv->gui) { + g_object_unref (G_OBJECT (editor->priv->gui)); + } + g_free (editor->priv); g_signal_handlers_disconnect_by_func (G_OBJECT(gl_prefs), diff --git a/glabels2/src/view-text.c b/glabels2/src/view-text.c index 67a618e7..f2a078bd 100644 --- a/glabels2/src/view-text.c +++ b/glabels2/src/view-text.c @@ -57,11 +57,12 @@ struct _glViewTextPrivate { GList *item_list; +#ifdef EDIT_TEXT_IN_PLACE GnomeCanvasItem *cursor; gboolean cursor_visible; gboolean cursor_state; guint cursor_timeout; - +#endif }; /*========================================================*/ @@ -217,7 +218,9 @@ gl_view_text_new (glLabelText *object, /* Create analogous canvas item. */ draw_hacktext (view_text); +#ifdef EDIT_TEXT_IN_PLACE draw_cursor (view_text); +#endif g_signal_connect (G_OBJECT (object), "changed", G_CALLBACK (update_canvas_item_from_object_cb), view_text); @@ -226,8 +229,10 @@ gl_view_text_new (glLabelText *object, G_CALLBACK (item_event_cb), view_text); buffer = gl_label_text_get_buffer (object); +#ifdef EDIT_TEXT_IN_PLACE g_signal_connect (G_OBJECT (buffer), "mark-set", G_CALLBACK (mark_set_cb), view_text); +#endif gl_debug (DEBUG_VIEW, "END"); @@ -295,7 +300,9 @@ update_canvas_item_from_object_cb (glLabelObject *object, /* Adjust appearance of analogous canvas item. */ draw_hacktext (view_text); +#ifdef EDIT_TEXT_IN_PLACE draw_cursor (view_text); +#endif gl_debug (DEBUG_VIEW, "END"); } @@ -753,6 +760,7 @@ draw_hacktext (glViewText *view_text) } /* clean up */ + g_free (font_family); gl_color_node_free (&color_node); g_strfreev (line); g_free (text); @@ -760,6 +768,7 @@ draw_hacktext (glViewText *view_text) gl_debug (DEBUG_VIEW, "END"); } +#ifdef EDIT_TEXT_IN_PLACE /*--------------------------------------------------------------------------*/ /* PRIVATE. Draw cursor to item (group). */ /*--------------------------------------------------------------------------*/ @@ -971,6 +980,8 @@ blink_cb (glViewText *view_text) return FALSE; } +#endif /* EDIT_TEXT_IN_PLACE */ + /*--------------------------------------------------------------------------*/ /* PRIVATE. Item event callback. */ /*--------------------------------------------------------------------------*/ -- 2.39.5