Revision: 55523
http://sourceforge.net/p/brlcad/code/55523
Author: brlcad
Date: 2013-05-21 20:10:24 +0000 (Tue, 21 May 2013)
Log Message:
-----------
make rt_clean() work even if it's an rtip that no longer has a dbip handle
(instead of crashing)
Modified Paths:
--------------
brlcad/trunk/src/librt/prep.c
Modified: brlcad/trunk/src/librt/prep.c
===================================================================
--- brlcad/trunk/src/librt/prep.c 2013-05-21 20:09:32 UTC (rev 55522)
+++ brlcad/trunk/src/librt/prep.c 2013-05-21 20:10:24 UTC (rev 55523)
@@ -939,7 +939,8 @@
/* Free animation structures */
/* XXX modify to only free those from this rtip */
- db_free_anim(rtip->rti_dbip);
+ if (rtip->rti_dbip)
+ db_free_anim(rtip->rti_dbip);
/* Free array of solid table pointers indexed by solid ID */
for (i=0; i <= ID_MAX_SOLID; i++) {
@@ -1006,25 +1007,28 @@
bu_hist_free(&rtip->rti_hist_cutdepth);
bu_hist_free(&rtip->rti_hist_cell_pieces);
- /*
- * Zero the solid instancing counters in dbip database instance.
- * Done here because the same dbip could be used by multiple
- * rti's, and rt_gettrees() can be called multiple times on this
- * one rtip.
- *
- * There is a race (collision!) here on d_uses if rt_gettrees() is
- * called on another rtip of the same dbip before this rtip is
- * done with all its treewalking.
- *
- * This must be done for each 'clean' to keep
- * rt_find_identical_solid() working properly as d_uses goes up.
- */
- for (i=0; i < RT_DBNHASH; i++) {
- register struct directory *dp;
+ if (rtip->rti_dbip) {
+ /*
+ * Zero the solid instancing counters in dbip database
+ * instance. Done here because the same dbip could be used by
+ * multiple rti's, and rt_gettrees() can be called multiple
+ * times on this one rtip.
+ *
+ * FIXME: There is a race (collision!) here on d_uses if
+ * rt_gettrees() is called on another rtip of the same dbip
+ * before this rtip is done with all its treewalking.
+ *
+ * This must be done for each 'clean' to keep
+ * rt_find_identical_solid() working properly as d_uses goes
+ * up.
+ */
+ for (i=0; i < RT_DBNHASH; i++) {
+ register struct directory *dp;
- dp = rtip->rti_dbip->dbi_Head[i];
- for (; dp != RT_DIR_NULL; dp = dp->d_forw)
- dp->d_uses = 0;
+ dp = rtip->rti_dbip->dbi_Head[i];
+ for (; dp != RT_DIR_NULL; dp = dp->d_forw)
+ dp->d_uses = 0;
+ }
}
bu_ptbl_reset(&rtip->delete_regs);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits