dia r3955 - in trunk: . app bindings lib objects/UML objects/standard plug-ins/python



Author: hans
Date: Fri Apr 25 18:11:21 2008
New Revision: 3955
URL: http://svn.gnome.org/viewvc/dia?rev=3955&view=rev

Log:
2008-04-25  Hans Breuer  <hans breuer org>

	* lib/diagdkrenderer.c lib/diasvgrenderer.c lib/dialibartrenderer.c 
	  app/diapsrenderer.c app/diapsft2renderer.c : all 
	DiaRenderer::draw_string() methods	were leaking their text_line
	* lib/textline.c(text_line_destroy) : use clear_layout_offset()
	instead of leaking cached values
	* lib/autoroute.c : othconn_set_points does not eat points
	* app/diagram.c : return of diagram_get_name() must be free'd
	* objects/standard/line.c : connpointline_create must be paired with
	connpointline_destroy()
	* objects/standard/outline.c : object_init() needs object_destroy()
	* objects/UML/state.c : don't miss to free action strings
	* objects/UML/transition.c : also leaking strings



Modified:
   trunk/ChangeLog
   trunk/app/diagram.c
   trunk/app/diapsft2renderer.c
   trunk/app/diapsrenderer.c
   trunk/bindings/Makefile.am
   trunk/bindings/dia-properties.h
   trunk/lib/autoroute.c
   trunk/lib/diagdkrenderer.c
   trunk/lib/dialibartrenderer.c
   trunk/lib/diasvgrenderer.c
   trunk/lib/textline.c
   trunk/lib/widgets.c
   trunk/objects/UML/state.c
   trunk/objects/UML/transition.c
   trunk/objects/standard/line.c
   trunk/objects/standard/outline.c
   trunk/plug-ins/python/aobjects.py

Modified: trunk/app/diagram.c
==============================================================================
--- trunk/app/diagram.c	(original)
+++ trunk/app/diagram.c	Fri Apr 25 18:11:21 2008
@@ -364,8 +364,10 @@
 diagram_modified(Diagram *dia)
 {
   GSList *displays;
-  gchar *title = g_strdup_printf ("%s%s", diagram_is_modified(dia) ? "*" : "", diagram_get_name(dia));
+  gchar *dia_name = diagram_get_name(dia);
+  gchar *title = g_strdup_printf ("%s%s", diagram_is_modified(dia) ? "*" : "", dia_name);
 
+  g_free (dia_name);
   displays = dia->displays;
   while (displays!=NULL) {
     DDisplay *ddisp = (DDisplay *) displays->data;

Modified: trunk/app/diapsft2renderer.c
==============================================================================
--- trunk/app/diapsft2renderer.c	(original)
+++ trunk/app/diapsft2renderer.c	Fri Apr 25 18:11:21 2008
@@ -343,6 +343,7 @@
 				      renderer->current_height);
   real width = text_line_get_width(text_line);
   draw_text_line(self, text_line, pos, alignment, color);
+  text_line_destroy(text_line);
 }
 
 static void

Modified: trunk/app/diapsrenderer.c
==============================================================================
--- trunk/app/diapsrenderer.c	(original)
+++ trunk/app/diapsrenderer.c	Fri Apr 25 18:11:21 2008
@@ -655,6 +655,7 @@
 #ifdef DRAW_STRING_WITH_TEXT_LINE
   TextLine *text_line = text_line_new(text, self->font, self->font_height);
   draw_text_line(self, text_line, pos, alignment, color);
+  text_line_destroy(text_line);
 #else
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
   gchar *buffer;

Modified: trunk/bindings/Makefile.am
==============================================================================
--- trunk/bindings/Makefile.am	(original)
+++ trunk/bindings/Makefile.am	Fri Apr 25 18:11:21 2008
@@ -75,6 +75,9 @@
 $(srcdir)/dia-python.cpp : $(INTERFACES)
 	$(SWIG) $(SWIG_PYTHON_OPT) -I$(top_srcdir) -I../lib -o $@ $<
 
+GCCXMLINC = -I.. -I../lib -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libxml2 -I/usr/include/libart-2.0   -I/usr/include/python2.5 -I/usr/include/libxml2
+$(srcdir)/dia-object.xml : $(INTERFACES)
+	gccxml --gccxml-cxxflags '$(GTK_CFLAGS) $(XML_CFLAGS)' -I$(top_srcdir) -I ../lib dia-object.cpp -fxml=$@
 
 EXTRA_DIST = \
 	dia.swig \

Modified: trunk/bindings/dia-properties.h
==============================================================================
--- trunk/bindings/dia-properties.h	(original)
+++ trunk/bindings/dia-properties.h	Fri Apr 25 18:11:21 2008
@@ -6,7 +6,6 @@
 #ifndef DIA__PROPERTIES_H
 #define DIA__PROPERTIES_H
 
-#include <string>
 #include <vector>
 
 #include "properties.h"

Modified: trunk/lib/autoroute.c
==============================================================================
--- trunk/lib/autoroute.c	(original)
+++ trunk/lib/autoroute.c	Fri Apr 25 18:11:21 2008
@@ -148,6 +148,7 @@
   
   if (min_badness < MAX_BADNESS) {
     orthconn_set_points(conn, best_num_points, best_layout);
+    g_free(best_layout);
     return TRUE;
   } else {
     g_free(best_layout);

Modified: trunk/lib/diagdkrenderer.c
==============================================================================
--- trunk/lib/diagdkrenderer.c	(original)
+++ trunk/lib/diagdkrenderer.c	Fri Apr 25 18:11:21 2008
@@ -633,6 +633,7 @@
 {
   TextLine *text_line = text_line_new(text, object->font, object->font_height);
   draw_text_line(object, text_line, pos, alignment, color);
+  text_line_destroy(text_line);
 }
 
 #ifdef HAVE_FREETYPE

Modified: trunk/lib/dialibartrenderer.c
==============================================================================
--- trunk/lib/dialibartrenderer.c	(original)
+++ trunk/lib/dialibartrenderer.c	Fri Apr 25 18:11:21 2008
@@ -1225,6 +1225,7 @@
 {
   TextLine *text_line = text_line_new(text, self->font, self->font_height);
   draw_text_line(self, text_line, pos, alignment, color);
+  text_line_destroy(text_line);
 }
 
 

Modified: trunk/lib/diasvgrenderer.c
==============================================================================
--- trunk/lib/diasvgrenderer.c	(original)
+++ trunk/lib/diasvgrenderer.c	Fri Apr 25 18:11:21 2008
@@ -645,6 +645,7 @@
 {    
   TextLine *text_line = text_line_new(text, self->font, self->font_height);
   draw_text_line(self, text_line, pos, alignment, colour);
+  text_line_destroy(text_line);
   return;
 #if 0
   DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);

Modified: trunk/lib/textline.c
==============================================================================
--- trunk/lib/textline.c	(original)
+++ trunk/lib/textline.c	Fri Apr 25 18:11:21 2008
@@ -35,6 +35,7 @@
 
 static void text_line_dirty_cache(TextLine *text_line);
 static void text_line_cache_values(TextLine *text_line);
+static void clear_layout_offset (TextLine *text_line);
 
 /** Sets this object to display a particular string.
  * @param text_line The object to change.
@@ -123,7 +124,8 @@
   if (text_line->font != NULL) {
     dia_font_unref(text_line->font);
   }
-  /* TODO: Handle renderer's cached content. */
+  clear_layout_offset (text_line);
+  g_free (text_line->offsets);
   g_free(text_line);
 }
 

Modified: trunk/lib/widgets.c
==============================================================================
--- trunk/lib/widgets.c	(original)
+++ trunk/lib/widgets.c	Fri Apr 25 18:11:21 2008
@@ -2162,6 +2162,7 @@
   gtk_widget_style_get_property(GTK_WIDGET(button), "focus-padding", prop);
   i = g_value_get_int(prop);
   g_value_set_int(prop, 0);
+  g_free(prop);
 
   gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
   /*  gtk_button_set_focus_on_click(GTK_BUTTON(button), FALSE);*/

Modified: trunk/objects/UML/state.c
==============================================================================
--- trunk/objects/UML/state.c	(original)
+++ trunk/objects/UML/state.c	Fri Apr 25 18:11:21 2008
@@ -459,6 +459,10 @@
 static void
 state_destroy(State *state)
 {
+  g_free (state->entry_action);
+  g_free (state->do_action);
+  g_free (state->exit_action);
+
   text_destroy(state->text);
 
   element_destroy(&state->element);

Modified: trunk/objects/UML/transition.c
==============================================================================
--- trunk/objects/UML/transition.c	(original)
+++ trunk/objects/UML/transition.c	Fri Apr 25 18:11:21 2008
@@ -288,6 +288,9 @@
 static void
 transition_destroy(Transition* transition)
 {
+  g_free (transition->trigger_text);
+  g_free (transition->action_text);
+  g_free (transition->guard_text);
   orthconn_destroy(&transition->orth);
 }
 

Modified: trunk/objects/standard/line.c
==============================================================================
--- trunk/objects/standard/line.c	(original)
+++ trunk/objects/standard/line.c	Fri Apr 25 18:11:21 2008
@@ -412,6 +412,7 @@
 static void
 line_destroy(Line *line)
 {
+  connpointline_destroy(line->cpl);
   connection_destroy(&line->connection);
 }
 

Modified: trunk/objects/standard/outline.c
==============================================================================
--- trunk/objects/standard/outline.c	(original)
+++ trunk/objects/standard/outline.c	Fri Apr 25 18:11:21 2008
@@ -488,7 +488,8 @@
 {
   if (outline->path)
     cairo_path_destroy (outline->path);
-  g_free (outline->name);
+  g_free (outline->name);
+  object_destroy(&outline->object);
   /* but not the object itself? */
 }
 static void 

Modified: trunk/plug-ins/python/aobjects.py
==============================================================================
--- trunk/plug-ins/python/aobjects.py	(original)
+++ trunk/plug-ins/python/aobjects.py	Fri Apr 25 18:11:21 2008
@@ -66,6 +66,9 @@
 				continue # can't create empty group
 			#print st
 			o, h1, h2 = dia.get_object_type(st).create (cx, cy)
+			# make it a bit more interesting
+			if o.properties.has_key("name") :
+				o.properties["name"] = st
 			w = o.bounding_box.right - o.bounding_box.left
 			h = o.bounding_box.bottom - o.bounding_box.top
 			o.move (cx, cy)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]