[EMAIL PROTECTED] wrote:
Brian wrote:
After some more digging, here's what I've come up with:
* When you hit enter, the button widget is 'activated'
* e_widget_activate() calls the No buttons callback, which
deletes the dialog
* this frees the evas, which frees its layers, which frees
its objects, which happens to set obj->callbacks to NULL
* e is still looping through its callbacks at this point,
and segfaults
* the NULL check in the aforementioned patch happens to work,
but only by luck (the object pointer its accessing is now
invalid).
So, should we require that evas callbacks not free their evas?
(E.g. force them to schedule a free and then actually do it
outside of any callbacks)
Or, should we alter evas to defer evas frees while walking
an object's callbacks?
Ummm... this is really more raster's domain of intimacy :)
but I'd say that an evas obj's callback shouldn't free an evas
(wether the one it's in or any other), but the latter possibility
sounds like it could be reasonable as well.. I'd have to look at
this in more detail to give any real suggestion on my part though.
It will be damn hard to prevent an evas event to kill itself.
Anyway, this patch works. Please review.
Sebastian
Index: src/lib/canvas/evas_callbacks.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_callbacks.c,v
retrieving revision 1.30
diff -u -r1.30 evas_callbacks.c
--- src/lib/canvas/evas_callbacks.c 5 Apr 2007 15:40:51 -0000 1.30
+++ src/lib/canvas/evas_callbacks.c 19 Apr 2007 17:14:32 -0000
@@ -276,6 +276,7 @@
if ((obj->smart.parent) && (type != EVAS_CALLBACK_FREE) &&
(type <= EVAS_CALLBACK_KEY_UP))
evas_object_event_callback_call(obj->smart.parent, type, event_info);
+ if (e->delete_me) evas_free(e);
}
/**
Index: src/lib/canvas/evas_main.c
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/canvas/evas_main.c,v
retrieving revision 1.32
diff -u -r1.32 evas_main.c
--- src/lib/canvas/evas_main.c 16 Nov 2006 03:20:24 -0000 1.32
+++ src/lib/canvas/evas_main.c 19 Apr 2007 17:14:32 -0000
@@ -101,6 +101,12 @@
Evas_Object *o;
o = (Evas_Object *)ll;
+ if ((o->callbacks) && (o->callbacks->walking_list))
+ {
+ /* Defer free */
+ e->delete_me = 1;
+ return;
+ }
if (!o->delete_me)
del = 1;
}
Index: src/lib/include/evas_private.h
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/lib/include/evas_private.h,v
retrieving revision 1.81
diff -u -r1.81 evas_private.h
--- src/lib/include/evas_private.h 21 Feb 2007 21:43:45 -0000 1.81
+++ src/lib/include/evas_private.h 19 Apr 2007 17:14:33 -0000
@@ -340,6 +340,8 @@
int last_mouse_down_counter;
int last_mouse_up_counter;
Evas_Font_Hinting_Flags hinting;
+
+ unsigned char delete_me : 1;
};
struct _Evas_Layer
@@ -455,7 +457,7 @@
void (*func) (void *data, Evas *e, Evas_Object *obj, void *event_info);
void *data;
Evas_Callback_Type type;
- char delete_me : 1;
+ unsigned char delete_me : 1;
};
struct _Evas_Data_Node
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel