Revision: 76601
http://sourceforge.net/p/brlcad/code/76601
Author: starseeker
Date: 2020-07-30 17:28:23 +0000 (Thu, 30 Jul 2020)
Log Message:
-----------
Make a stab at recursive calling warnings for the libtclcad level callbacks.
Won't prevent anything, but might at least warn what's going on.
Modified Paths:
--------------
brlcad/branches/bioh/include/tclcad.h
brlcad/branches/bioh/src/libtclcad/tclcad_obj.c
Modified: brlcad/branches/bioh/include/tclcad.h
===================================================================
--- brlcad/branches/bioh/include/tclcad.h 2020-07-30 15:08:14 UTC (rev
76600)
+++ brlcad/branches/bioh/include/tclcad.h 2020-07-30 17:28:23 UTC (rev
76601)
@@ -135,6 +135,7 @@
struct tclcad_ged_data {
struct ged *gedp;
struct bu_vls go_more_args_callback;
+ int go_more_args_callback_cnt;
// These are view related, but appear to be intended as global across all
// views associated with the gedp - that is why they are here and not in
@@ -141,6 +142,7 @@
// tclcad_view_data.
struct bu_hash_tbl *go_edited_paths;
struct bu_vls go_rt_end_callback;
+ int go_rt_end_callback_cnt;
int go_dlist_on;
int go_refresh_on;
@@ -155,7 +157,9 @@
struct tclcad_view_data {
struct ged *gedp;
struct bu_vls gdv_edit_motion_delta_callback;
+ int gdv_edit_motion_delta_callback_cnt;
struct bu_vls gdv_callback;
+ int gdv_callback_cnt;
struct fbserv_obj gdv_fbs;
};
Modified: brlcad/branches/bioh/src/libtclcad/tclcad_obj.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/tclcad_obj.c 2020-07-30 15:08:14 UTC
(rev 76600)
+++ brlcad/branches/bioh/src/libtclcad/tclcad_obj.c 2020-07-30 17:28:23 UTC
(rev 76601)
@@ -1319,7 +1319,9 @@
struct tclcad_ged_data *tgd;
BU_GET(tgd, struct tclcad_ged_data);
bu_vls_init(&tgd->go_rt_end_callback);
+ tgd->go_rt_end_callback_cnt = 0;
bu_vls_init(&tgd->go_more_args_callback);
+ tgd->go_more_args_callback_cnt = 0;
tgd->go_edited_paths = bu_hash_create(0);
tgd->gedp = top->to_gedp;
tgd->go_refresh_on = 1;
@@ -3597,8 +3599,13 @@
bu_vls_addr(&tvd->gdv_edit_motion_delta_callback),
bu_vls_addr(&tran_x_vls), bu_vls_addr(&tran_y_vls),
bu_vls_addr(&tran_z_vls));
+ tvd->gdv_edit_motion_delta_callback_cnt++;
+ if (tvd->gdv_edit_motion_delta_callback_cnt > 1) {
+ bu_log("Warning - recursive gdv_edit_motion_delta_callback
call\n");
+ }
+
Tcl_Eval(current_top->to_interp, bu_vls_addr(&tcl_cmd));
-
+ tvd->gdv_edit_motion_delta_callback_cnt++;
bu_vls_free(&tcl_cmd);
bu_vls_free(&tran_x_vls);
bu_vls_free(&tran_y_vls);
@@ -3714,7 +3721,12 @@
struct tclcad_view_data *tvd = (struct tclcad_view_data *)gdvp->u_data;
if (0 < bu_vls_strlen(&tvd->gdv_callback)) {
+ tvd->gdv_callback_cnt++;
+ if (tvd->gdv_callback_cnt > 1) {
+ bu_log("Warning - recursive gvd_callback call\n");
+ }
tclcad_eval_noresult(current_top->to_interp,
bu_vls_addr(&tvd->gdv_callback), 0, NULL);
+ tvd->gdv_callback_cnt--;
}
need_refresh = 1;
@@ -4576,7 +4588,9 @@
struct tclcad_view_data *tvd;
BU_GET(tvd, struct tclcad_view_data);
bu_vls_init(&tvd->gdv_edit_motion_delta_callback);
+ tvd->gdv_edit_motion_delta_callback_cnt = 0;
bu_vls_init(&tvd->gdv_callback);
+ tvd->gdv_callback_cnt = 0;
tvd->gedp = current_top->to_gedp;
new_gdvp->u_data = (void *)tvd;
@@ -6420,7 +6434,12 @@
struct tclcad_view_data *tvd = (struct tclcad_view_data *)gdvp->u_data;
if (0 < bu_vls_strlen(&tvd->gdv_callback)) {
+ tvd->gdv_callback_cnt++;
+ if (tvd->gdv_callback_cnt > 1) {
+ bu_log("Warning - recursive gvd_callback call\n");
+ }
Tcl_Eval(current_top->to_interp, bu_vls_addr(&tvd->gdv_callback));
+ tvd->gdv_callback_cnt--;
}
to_refresh_view(gdvp);
@@ -6620,10 +6639,14 @@
struct tclcad_ged_data *tgd = (struct tclcad_ged_data
*)current_top->to_gedp->u_data;
if (0 < bu_vls_strlen(&tgd->go_rt_end_callback)) {
struct bu_vls callback_cmd = BU_VLS_INIT_ZERO;
-
+ tgd->go_rt_end_callback_cnt++;
+ if (tgd->go_rt_end_callback_cnt > 1) {
+ bu_log("Warning - recursive go_rt_end_callback call\n");
+ }
bu_vls_printf(&callback_cmd, "%s %d",
bu_vls_addr(&tgd->go_rt_end_callback), aborted);
Tcl_Eval(current_top->to_interp, bu_vls_addr(&callback_cmd));
+ tgd->go_rt_end_callback_cnt--;
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits