Revision: 78024
http://sourceforge.net/p/brlcad/code/78024
Author: starseeker
Date: 2020-12-19 15:32:04 +0000 (Sat, 19 Dec 2020)
Log Message:
-----------
If a file doesn't report a valid .g header, don't keep opening it in MGED.
Modified Paths:
--------------
brlcad/trunk/NEWS
brlcad/trunk/TODO
brlcad/trunk/src/mged/mged.c
Modified: brlcad/trunk/NEWS
===================================================================
--- brlcad/trunk/NEWS 2020-12-19 15:14:30 UTC (rev 78023)
+++ brlcad/trunk/NEWS 2020-12-19 15:32:04 UTC (rev 78024)
@@ -13,6 +13,7 @@
--- 2020-xx-xx Release 7.32.2 ---
----------------------------------------------------------------------
+* updated MGED to not open non-.g-files as databases - Cliff Yapp
* fixed problems with command I/O management in MGED - Cliff Yapp
* added decimation control examples to facetize man page - Cliff Yapp
* changed gcv converter to append to existing .g files - Cliff Yapp
Modified: brlcad/trunk/TODO
===================================================================
--- brlcad/trunk/TODO 2020-12-19 15:14:30 UTC (rev 78023)
+++ brlcad/trunk/TODO 2020-12-19 15:32:04 UTC (rev 78024)
@@ -20,12 +20,7 @@
* check thread safety history of gqa + plot calls (pl_color)
-* f_dbopen in MGED doesn't seem to be reporting failure
- if a non-.g file is fed to opendb. That doesn't seem
- right... shouldn't the open process completely fail
- if the file isn't a valid .g?
-
THESE TASKS SHOULD HAPPEN WITHIN TWO RELEASE ITERATIONS
-------------------------------------------------------
Modified: brlcad/trunk/src/mged/mged.c
===================================================================
--- brlcad/trunk/src/mged/mged.c 2020-12-19 15:14:30 UTC (rev 78023)
+++ brlcad/trunk/src/mged/mged.c 2020-12-19 15:32:04 UTC (rev 78024)
@@ -2733,6 +2733,14 @@
} else {
/* Opened existing database file */
+ /* If dbi_version < 0, file isn't a valid .g file - don't proceed */
+ if (DBIP->dbi_version < 0) {
+ bu_free(DBIP->dbi_filename, "free filename");
+ DBIP = DBI_NULL;
+ Tcl_AppendResult(interpreter, "opendb: ", argv[1], " is not a
valid database\n", (char *)NULL);
+ return TCL_ERROR;
+ }
+
/* Scan geometry database and build in-memory directory */
(void)db_dirbuild(DBIP);
}
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