Revision: 42183
http://brlcad.svn.sourceforge.net/brlcad/?rev=42183&view=rev
Author: brlcad
Date: 2011-01-12 23:28:59 +0000 (Wed, 12 Jan 2011)
Log Message:
-----------
one of the more complicated ways to handle BU_SETJUMPing so that variables set
before the jump and accessed afterwards do not have their values clobbered when
a jump occurs. solution is to pull just exactly the try/catch code out into
their own functions so there are no variables in that frame that might be
clobbered in the first place. this is done twice here.
Modified Paths:
--------------
brlcad/trunk/src/mged/dodraw.c
Modified: brlcad/trunk/src/mged/dodraw.c
===================================================================
--- brlcad/trunk/src/mged/dodraw.c 2011-01-12 23:26:34 UTC (rev 42182)
+++ brlcad/trunk/src/mged/dodraw.c 2011-01-12 23:28:59 UTC (rev 42183)
@@ -514,7 +514,7 @@
rt_db_free_internal(&intern);
return 0;
- out:
+out:
/* Successful fastpath drawing of this solid */
{
struct db_full_path pp;
@@ -534,6 +534,60 @@
}
+int
+process_boolean(const struct db_full_path *pathp, union tree *curtree, struct
db_tree_state *tsp)
+{
+ int failed = 1;
+
+ if (!BU_SETJUMP) {
+ /* try */
+
+ failed = nmg_boolean(curtree, *tsp->ts_m, tsp->ts_tol, &rt_uniresource);
+
+ } else {
+ /* catch */
+
+ char *sofar = db_path_to_string(pathp);
+
+ BU_UNSETJUMP;
+
+ Tcl_AppendResult(INTERP, "WARNING: Boolean evaluation of ", sofar,
+ " failed!!!\n", (char *)NULL);
+ bu_free((genptr_t)sofar, "path string");
+ db_free_tree(curtree, &rt_uniresource);
+
+ return failed;
+
+ } BU_UNSETJUMP;
+
+ return failed;
+}
+
+
+void
+process_triangulate(const struct db_full_path *pathp, union tree *curtree,
struct db_tree_state *tsp)
+{
+ if (!BU_SETJUMP) {
+ /* try */
+
+ nmg_triangulate_model(*tsp->ts_m, tsp->ts_tol);
+
+ } else {
+ /* catch */
+
+ char *sofar = db_path_to_string(pathp);
+
+ BU_UNSETJUMP;
+
+ Tcl_AppendResult(INTERP, "WARNING: Triangulation of ", sofar,
+ " failed!!!\n", (char *)NULL);
+ bu_free((genptr_t)sofar, "path string");
+ db_free_tree(curtree, &rt_uniresource);
+ return;
+ } BU_UNSETJUMP;
+}
+
+
/*
* M G E D _ N M G _ R E G I O N _ E N D
*
@@ -563,19 +617,9 @@
if (curtree->tr_op == OP_NOP) return curtree;
if (!mged_draw_nmg_only) {
- if (BU_SETJUMP) {
- char *sofar = db_path_to_string(pathp);
- BU_UNSETJUMP;
+ failed = process_boolean(pathp, curtree, tsp);
- Tcl_AppendResult(INTERP, "WARNING: Boolean evaluation of ", sofar,
- " failed!!!\n", (char *)NULL);
- bu_free((genptr_t)sofar, "path string");
- db_free_tree(curtree, &rt_uniresource);
- return (union tree *)NULL;
- }
- failed = nmg_boolean(curtree, *tsp->ts_m, tsp->ts_tol, &rt_uniresource);
- BU_UNSETJUMP;
if (failed) {
db_free_tree(curtree, &rt_uniresource);
return (union tree *)NULL;
@@ -594,19 +638,7 @@
}
if (mged_nmg_triangulate) {
- if (BU_SETJUMP) {
- char *sofar = db_path_to_string(pathp);
-
- BU_UNSETJUMP;
-
- Tcl_AppendResult(INTERP, "WARNING: Triangulation of ", sofar,
- " failed!!!\n", (char *)NULL);
- bu_free((genptr_t)sofar, "path string");
- db_free_tree(curtree, &rt_uniresource);
- return (union tree *)NULL;
- }
- nmg_triangulate_model(*tsp->ts_m, tsp->ts_tol);
- BU_UNSETJUMP;
+ process_triangulate(pathp, curtree, tsp);
}
if (r != 0) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits