Revision: 50321
          http://brlcad.svn.sourceforge.net/brlcad/?rev=50321&view=rev
Author:   bob1961
Date:     2012-04-26 15:19:40 +0000 (Thu, 26 Apr 2012)
Log Message:
-----------
Added the tclcad_initialized flag to insure that libtclcad doesn't get 
initialized more than once. This case turned up after an rtwizard enhancement.

Modified Paths:
--------------
    brlcad/trunk/src/libtclcad/CMakeLists.txt
    brlcad/trunk/src/libtclcad/tclcad.c
    brlcad/trunk/src/libtclcad/tclcad_obj.c

Added Paths:
-----------
    brlcad/trunk/src/libtclcad/tclcad_private.h

Modified: brlcad/trunk/src/libtclcad/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libtclcad/CMakeLists.txt   2012-04-26 13:56:46 UTC (rev 
50320)
+++ brlcad/trunk/src/libtclcad/CMakeLists.txt   2012-04-26 15:19:40 UTC (rev 
50321)
@@ -32,6 +32,8 @@
   )
 BRLCAD_ADDLIB(libtclcad "${LIBTCLCAD_SRCS}" 
"libged;libdm;${TCLCAD_XLIBS};${X11_Xi_LIB}")
 SET_TARGET_PROPERTIES(libtclcad PROPERTIES VERSION 19.0.1 SOVERSION 19)
+set(tclcad_ignore_files tclcad_private.h)
+CMAKEFILES(${tclcad_ignore_files})
 CMAKEFILES(Makefile.am)
 
 # Local Variables:

Modified: brlcad/trunk/src/libtclcad/tclcad.c
===================================================================
--- brlcad/trunk/src/libtclcad/tclcad.c 2012-04-26 13:56:46 UTC (rev 50320)
+++ brlcad/trunk/src/libtclcad/tclcad.c 2012-04-26 15:19:40 UTC (rev 50321)
@@ -44,12 +44,15 @@
 
 /* Private headers */
 #include "brlcad_version.h"
+#include "tclcad_private.h"
 
 
 /* defined in cmdhist_obj.c */
 extern int Cho_Init(Tcl_Interp *interp);
 
+int tclcad_initialized = 0;
 
+
 static int
 wrapper_func(ClientData data, Tcl_Interp *interp, int argc, const char *argv[])
 {
@@ -73,6 +76,11 @@
 int
 Tclcad_Init(Tcl_Interp *interp)
 {
+    if (tclcad_initialized)
+       return TCL_OK;
+
+    tclcad_initialized = 1;
+
     if (Tcl_Init(interp) == TCL_ERROR) {
        return TCL_ERROR;
     }

Modified: brlcad/trunk/src/libtclcad/tclcad_obj.c
===================================================================
--- brlcad/trunk/src/libtclcad/tclcad_obj.c     2012-04-26 13:56:46 UTC (rev 
50320)
+++ brlcad/trunk/src/libtclcad/tclcad_obj.c     2012-04-26 15:19:40 UTC (rev 
50321)
@@ -90,6 +90,8 @@
 #  include "dm-wgl.h"
 #endif /* DM_WGL */
 
+/* Private headers */
+#include "tclcad_private.h"
 
 #define TO_MAX_RT_ARGS 64
 #define TO_UNLIMITED -1
@@ -1143,6 +1145,11 @@
 int
 Go_Init(Tcl_Interp *interp)
 {
+    if (tclcad_initialized)
+       return TCL_OK;
+
+    tclcad_initialized = 1;
+
     /*XXX Use of brlcad_interp is temporary */
     brlcad_interp = interp;
 

Added: brlcad/trunk/src/libtclcad/tclcad_private.h
===================================================================
--- brlcad/trunk/src/libtclcad/tclcad_private.h                         (rev 0)
+++ brlcad/trunk/src/libtclcad/tclcad_private.h 2012-04-26 15:19:40 UTC (rev 
50321)
@@ -0,0 +1,46 @@
+/*                   T C L C A D _ P R I V A T E . H
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2012 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file tclcad_private.h
+ *
+ * Private header for libtclcad.
+ *
+ */
+
+#ifndef __TCLCAD_PRIVATE_H__
+#define __TCLCAD_PRIVATE_H__
+
+__BEGIN_DECLS
+
+extern int tclcad_initialized;
+
+__END_DECLS
+
+#endif /* __TCLCAD_PRIVATE_H__ */
+
+/** @} */
+/*
+ * Local Variables:
+ * mode: C
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */


Property changes on: brlcad/trunk/src/libtclcad/tclcad_private.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to