[dia] diagram-as-element: avoid endless recursion for pathologic case
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] diagram-as-element: avoid endless recursion for pathologic case
- Date: Thu, 5 Aug 2010 18:42:25 +0000 (UTC)
commit 18baf69ddd944b5c7bcfc1c186a85df74c586c7e
Author: Hans Breuer <hans breuer org>
Date: Thu Aug 5 20:19:12 2010 +0200
diagram-as-element: avoid endless recursion for pathologic case
The sample std-props-test.dia has such a pathologic case,
a 'Misc - Diagram' object referencing the parent diagram.
The expected endless mirror effect is stopped after the
first iteration ;)
objects/Misc/diagram_as_object.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/objects/Misc/diagram_as_object.c b/objects/Misc/diagram_as_object.c
index 6c62ba0..3709729 100644
--- a/objects/Misc/diagram_as_object.c
+++ b/objects/Misc/diagram_as_object.c
@@ -232,7 +232,12 @@ _dae_update_data(DiagramAsElement *dae)
struct utimbuf utbuf;
Element *elem = &dae->element;
DiaObject *obj = &elem->object;
+ static int working = 0;
+ if (working > 1)
+ return; /* protect against infinite recursion */
+ ++working;
+
if ( strlen(dae->filename)
#if GLIB_CHECK_VERSION(2,18,0)
&& g_utime(dae->filename, &utbuf) == 0
@@ -268,6 +273,8 @@ _dae_update_data(DiagramAsElement *dae)
/* adjust objects position, otherwise it'll jump on move */
obj->position = elem->corner;
+
+ --working;
}
static void
_dae_destroy(DiagramAsElement *dae)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]