[brlcad-commits] SF.net SVN: brlcad:[33726] brlcad/trunk/src/mged
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <br...@us...> - 2009-02-10 06:26:37
|
Revision: 33726 http://brlcad.svn.sourceforge.net/brlcad/?rev=33726&view=rev Author: brlcad Date: 2009-02-10 06:26:33 +0000 (Tue, 10 Feb 2009) Log Message: ----------- gedp needs to be non-null. it should exist for the life of the caller making libged calls. move ged init into mged_setup but keep the wdbp association else all goes to hell. Modified Paths: -------------- brlcad/trunk/src/mged/mged.c brlcad/trunk/src/mged/setup.c Modified: brlcad/trunk/src/mged/mged.c =================================================================== --- brlcad/trunk/src/mged/mged.c 2009-02-10 00:32:30 UTC (rev 33725) +++ brlcad/trunk/src/mged/mged.c 2009-02-10 06:26:33 UTC (rev 33726) @@ -2257,6 +2257,12 @@ db_close(dbip); #endif + if (gedp->ged_gdp) + ged_drawable_close(gedp->ged_gdp); + + ged_free(gedp); + gedp = GED_NULL; + /* XXX should deallocate libbu semaphores */ mged_global_variable_teardown(interp); @@ -2464,34 +2470,23 @@ return 0; } -void -ged_output_handler(struct ged *gedp, char *line) -{ - bu_log(line); -} -static void -ged_refresh_handler(void *clientdata) -{ - view_state->vs_flag = 1; - refresh(); -} - -/* - * F _ O P E N D B +/** + * F _ O P E N D B * - * Close the current database, if open, and then open a new database. - * May also open a display manager, if interactive and none selected yet. + * Close the current database, if open, and then open a new database. + * May also open a display manager, if interactive and none selected + * yet. * - * argv[1] is the filename. + * argv[1] is the filename. * - * There are two invocations: + * There are two invocations: * main() * cmdline() Only one arg is permitted. * - * Returns TCL_OK if the database opened - * Returns TCL_ERROR if the database was not opened (and the user did - * not interactively abort) + * Returns: + * TCL_OK if database was opened. + * TCL_ERROR if database was NOT opened (and the user didn't abort) */ int f_opendb( @@ -2711,12 +2706,6 @@ return TCL_ERROR; } - BU_GETSTRUCT(gedp, ged); - GED_INIT(gedp, wdbp); - - gedp->ged_output_handler = ged_output_handler; - gedp->ged_refresh_handler = ged_refresh_handler; - /*XXX shouldn't need any of this */ #if 1 /* increment use count for this db instance */ @@ -2733,6 +2722,9 @@ return TCL_ERROR; } + /* associate the gedp with this wdbp */ + GED_INIT(gedp, wdbp); + /* This creates a "db" command object */ if (wdb_create_cmd(interp, wdbp, MGED_DB_NAME) != TCL_OK) { bu_vls_printf(&msg, "%s\n%s\n", @@ -2861,10 +2853,9 @@ #endif ged_drawable_close(gedp->ged_gdp); - ged_free(gedp); + gedp->ged_wdbp = RT_WDB_NULL; /* wipe out the global pointers */ - gedp = GED_NULL; dbip = DBI_NULL; rt_new_material_head(MATER_NULL); Modified: brlcad/trunk/src/mged/setup.c =================================================================== --- brlcad/trunk/src/mged/setup.c 2009-02-10 00:32:30 UTC (rev 33725) +++ brlcad/trunk/src/mged/setup.c 2009-02-10 06:26:33 UTC (rev 33726) @@ -446,6 +446,21 @@ } +static void +mged_output_handler(struct ged *gedp, char *line) +{ + bu_log(line); +} + + +static void +mged_refresh_handler(void *clientdata) +{ + view_state->vs_flag = 1; + refresh(); +} + + /* * Initialize mged, configure the path, set up the tcl interpreter. */ @@ -565,6 +580,11 @@ view_state->vs_gvp->gv_clientData = (genptr_t)view_state; MAT_DELTAS_GET_NEG(view_state->vs_orig_pos, view_state->vs_gvp->gv_center); + BU_GETSTRUCT(gedp, ged); + + gedp->ged_output_handler = mged_output_handler; + gedp->ged_refresh_handler = mged_refresh_handler; + /* register commands */ cmd_setup(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |