changeset 251:f08b3ba9c1d8

Remove potential memory address error. - Fix memory address error in mb_prop_store_destroy(). - Invoke mb_prop_store_destroy() in redraw_man.c to free property stores for coord and shape objects.
author Thinker K.F. Li <thinker@branda.to>
date Sun, 04 Jan 2009 12:09:29 +0800
parents bd8ea44b421e
children 3271ea1ef96f
files src/event.c src/prop.c src/redraw_man.c
diffstat 3 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/event.c	Sun Jan 04 11:42:32 2009 +0800
+++ b/src/event.c	Sun Jan 04 12:09:29 2009 +0800
@@ -724,6 +724,7 @@
     } else {
 	coord = (coord_t *)obj;
 	area = coord_get_area(coord);
+	shape = NULL;
     }
 	
     if(IS_MBO_SHAPES(others_root)) {
--- a/src/prop.c	Sun Jan 04 11:42:32 2009 +0800
+++ b/src/prop.c	Sun Jan 04 12:09:29 2009 +0800
@@ -24,7 +24,7 @@
     if(last == NULL)
 	return;
 
-    for(entry = STAILQ_NEXT(mb_prop_entry_t, next, entry);
+    for(entry = STAILQ_NEXT(mb_prop_entry_t, next, last);
 	entry != NULL;
 	entry = STAILQ_NEXT(mb_prop_entry_t, next, entry)) {
 	STAILQ_REMOVE(prop_store->entries, mb_prop_entry_t, next, last);
--- a/src/redraw_man.c	Sun Jan 04 11:42:32 2009 +0800
+++ b/src/redraw_man.c	Sun Jan 04 12:09:29 2009 +0800
@@ -474,6 +474,7 @@
 	elmpool_elm_free(rdman->geo_pool, geo);
     }
     STAILQ_REMOVE(rdman->shapes, shape_t, sh_next, shape);
+    mb_prop_store_destroy(&shape->obj.props);
     shape->free(shape);
 
     if(rdman->last_mouse_over == (mb_obj_t *)shape)
@@ -638,6 +639,7 @@
 
     RM_CHILD(parent, coord);
     subject_free(coord->mouse_event);
+    mb_prop_store_destroy(&coord->obj.props);
     elmpool_elm_free(rdman->coord_pool, coord);
     rdman->n_coords--;