aboutsummaryrefslogtreecommitdiff
path: root/generic/tkZinc.c
diff options
context:
space:
mode:
authorlecoanet2000-08-31 12:24:45 +0000
committerlecoanet2000-08-31 12:24:45 +0000
commit07dbd74d7da704605620054fd71b57c95c5ea59c (patch)
treea54af56a7e48f3772d9ebe947043c610fb0021a5 /generic/tkZinc.c
parent728de2088dfcad1d003389423a5a363fb23918ea (diff)
downloadtkzinc-07dbd74d7da704605620054fd71b57c95c5ea59c.zip
tkzinc-07dbd74d7da704605620054fd71b57c95c5ea59c.tar.gz
tkzinc-07dbd74d7da704605620054fd71b57c95c5ea59c.tar.bz2
tkzinc-07dbd74d7da704605620054fd71b57c95c5ea59c.tar.xz
Correction de probl�mes de comptage de r�f�rence en Perl conduisant
� des fuites m�moires (utilisation de Tcl_SetObjResult).
Diffstat (limited to 'generic/tkZinc.c')
-rw-r--r--generic/tkZinc.c125
1 files changed, 104 insertions, 21 deletions
diff --git a/generic/tkZinc.c b/generic/tkZinc.c
index 74cb1bd..faf1d10 100644
--- a/generic/tkZinc.c
+++ b/generic/tkZinc.c
@@ -2499,7 +2499,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
}
wi->hot_item = item;
wi->hot_prev = item->previous;
- Tcl_SetObjResult(interp, NewLongObj(item->id));
+ l = NewLongObj(item->id);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
break;
/*
@@ -2588,7 +2592,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
lobjs[1] = NewDoubleObj(bbox.orig.y+wi->inset);
lobjs[2] = NewDoubleObj(bbox.corner.x+wi->inset);
lobjs[3] = NewDoubleObj(bbox.corner.y+wi->inset);
- Tcl_SetObjResult(interp, Tcl_NewListObj(4, lobjs));
+ l = Tcl_NewListObj(4, lobjs);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
}
break;
@@ -2873,6 +2881,9 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
l = NULL;
wi->current_item->class->Part(wi->current_item, &l, &wi->current_part);
Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
}
break;
@@ -3025,7 +3036,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
item = wi->text_info.focus_item;
if (argc == 2) {
if (item != ZN_NO_ITEM) {
- Tcl_SetObjResult(interp, NewLongObj(item->id));
+ l = NewLongObj(item->id);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
goto done;
}
@@ -3095,13 +3110,21 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
goto error;
}
if (item->parent != ZN_NO_ITEM) {
- Tcl_SetObjResult(interp, NewLongObj(item->parent->id));
+ l = NewLongObj(item->parent->id);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
else {
/*
* Top group is its own parent.
*/
- Tcl_SetObjResult(interp, NewLongObj(item->id));
+ l = NewLongObj(item->id);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
}
break;
@@ -3119,7 +3142,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
if ((result == ZN_ERROR) || (item == ZN_NO_ITEM)) {
goto error;
}
- Tcl_SetObjResult(interp, NewBooleanObj(item->class->has_anchors?1:0));
+ l = NewBooleanObj(item->class->has_anchors?1:0);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
break;
/*
@@ -3136,7 +3163,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
if ((result == ZN_ERROR) || (item == ZN_NO_ITEM)) {
goto error;
}
- Tcl_SetObjResult(interp, NewBooleanObj(item->class->has_fields?1:0));
+ l = NewBooleanObj(item->class->has_fields?1:0);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
break;
/*
@@ -3157,7 +3188,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
goto error;
}
if (!item->tags || !ZnListSize(item->tags)) {
- Tcl_SetObjResult(interp, NewBooleanObj(0));
+ l = NewBooleanObj(0);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
else {
num = ZnListSize(item->tags);
@@ -3165,11 +3200,19 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
tags = (Tk_Uid *) ZnListArray(item->tags);
for (i = 0; i < num; i++) {
if (tags[i] == tag_uid) {
- Tcl_SetObjResult(interp, NewBooleanObj(1));
+ l = NewBooleanObj(1);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
goto done;
}
}
- Tcl_SetObjResult(interp, NewBooleanObj(0));
+ l = NewBooleanObj(0);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
}
break;
@@ -3192,7 +3235,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
if (result != ZN_OK) {
goto error;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ l = Tcl_NewIntObj(index);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
goto done;
}
}
@@ -3372,7 +3419,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
lobjs[0] = Tcl_NewIntObj(wi->num_updates);
lobjs[1] = Tcl_NewIntObj(wi->last_time);
lobjs[2] = Tcl_NewIntObj(wi->total_time);
- Tcl_SetObjResult(interp, Tcl_NewListObj(3, lobjs));
+ l = Tcl_NewListObj(3, lobjs);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
}
break;
@@ -3390,7 +3441,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
if ((result == ZN_ERROR) || (item == ZN_NO_ITEM)) {
goto error;
}
- Tcl_SetObjResult(interp, NewBooleanObj(item->class->num_parts!=0));
+ l = NewBooleanObj(item->class->num_parts!=0);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
break;
/*
@@ -3650,7 +3705,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
goto error;
}
if (wi->text_info.sel_item != ZN_NO_ITEM) {
- Tcl_SetObjResult(interp, NewLongObj(wi->text_info.sel_item->id));
+ l = NewLongObj(wi->text_info.sel_item->id);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
break;
case ZN_SEL_TO:
@@ -3938,7 +3997,11 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
if ((result == ZN_ERROR) || (item == ZN_NO_ITEM)) {
goto error;
}
- Tcl_SetObjResult(interp, NewStringObj(item->class->name));
+ l = NewStringObj(item->class->name);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
break;
/*
@@ -5606,7 +5669,7 @@ MapInfoObjCmd(ClientData client_data,
{
int index, index2, result;
MapInfoMaster *master;
- Tcl_Obj *lobjs[7];
+ Tcl_Obj *l, *lobjs[7];
static char *sub_cmd_strings[] = {
"add", "count", "create", "delete", "duplicate",
"get", "remove", "replace", "scale", "translate", NULL
@@ -5875,7 +5938,11 @@ MapInfoObjCmd(ClientData client_data,
count = MapInfoNumArcs(master->map_info);
break;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(count));
+ l = Tcl_NewIntObj(count);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
break;
/*
@@ -5916,7 +5983,11 @@ MapInfoObjCmd(ClientData client_data,
lobjs[3] = Tcl_NewIntObj(y_from);
lobjs[4] = Tcl_NewIntObj(x_to);
lobjs[5] = Tcl_NewIntObj(y_to);
- Tcl_SetObjResult(interp, Tcl_NewListObj(6, lobjs));
+ l = Tcl_NewListObj(6, lobjs);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
break;
case ZN_E_SYMBOL:
@@ -5927,7 +5998,11 @@ MapInfoObjCmd(ClientData client_data,
lobjs[0] = Tcl_NewIntObj(x);
lobjs[1] = Tcl_NewIntObj(y);
lobjs[2] = Tcl_NewIntObj(symbol);
- Tcl_SetObjResult(interp, Tcl_NewListObj(3, lobjs));
+ l = Tcl_NewListObj(3, lobjs);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
break;
case ZN_E_TEXT:
@@ -5943,7 +6018,11 @@ MapInfoObjCmd(ClientData client_data,
lobjs[2] = NewStringObj(MapInfoTextStyleToString(text_style));
lobjs[3] = NewStringObj(MapInfoLineStyleToString(line_style));
lobjs[4] = NewStringObj(text);
- Tcl_SetObjResult(interp, Tcl_NewListObj(5, lobjs));
+ l = Tcl_NewListObj(5, lobjs);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
break;
case ZN_E_ARC:
@@ -5961,7 +6040,11 @@ MapInfoObjCmd(ClientData client_data,
lobjs[4] = Tcl_NewIntObj(radius);
lobjs[5] = Tcl_NewIntObj(start);
lobjs[6] = Tcl_NewIntObj(extent);
- Tcl_SetObjResult(interp, Tcl_NewListObj(7, lobjs));
+ l = Tcl_NewListObj(7, lobjs);
+ Tcl_SetObjResult(interp, l);
+#ifdef PTK
+ Tcl_DecrRefCount(l);
+#endif
}
break;
}