summaryrefslogtreecommitdiffstats
path: root/generic/tclLoad.c
diff options
context:
space:
mode:
authornijtmans <nijtmans@noemail.net>2008-10-07 20:51:45 (GMT)
committernijtmans <nijtmans@noemail.net>2008-10-07 20:51:45 (GMT)
commit3cebd284543a05fbcce595b6a94d076cd758e238 (patch)
treed84545033e20f70a541fc73d622ffe6b8526b48c /generic/tclLoad.c
parent69d19d9c43b6b447dd49748a4c72d86845267460 (diff)
downloadtcl-3cebd284543a05fbcce595b6a94d076cd758e238.zip
tcl-3cebd284543a05fbcce595b6a94d076cd758e238.tar.gz
tcl-3cebd284543a05fbcce595b6a94d076cd758e238.tar.bz2
* tclWinTest.c: Fix compiler warning when compiling this file with mingw gcc:
tclWinTest.c:706: warning: dereferencing type-punned pointer will break strict-aliasing rules * generic/tclLoad.c: Make sure that any library which doesn't have an unloadproc is only really unloaded when no library code is executed yet. [Bug 2059262] FossilOrigin-Name: 7c664fa36313e3e30445cd7f246a1d35bc1d00f9
Diffstat (limited to 'generic/tclLoad.c')
-rw-r--r--generic/tclLoad.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tclLoad.c b/generic/tclLoad.c
index 29e2d01..89e003c 100644
--- a/generic/tclLoad.c
+++ b/generic/tclLoad.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLoad.c,v 1.16 2007/02/20 23:24:03 nijtmans Exp $
+ * RCS: @(#) $Id: tclLoad.c,v 1.16.4.1 2008/10/07 20:51:46 nijtmans Exp $
*/
#include "tclInt.h"
@@ -795,7 +795,9 @@ Tcl_UnloadObjCmd(
if (unLoadProcPtr != NULL) {
Tcl_MutexLock(&packageMutex);
- (*unLoadProcPtr)(pkgPtr->loadHandle);
+ if (pkgPtr->unloadProc != NULL) {
+ (*unLoadProcPtr)(pkgPtr->loadHandle);
+ }
/*
* Remove this library from the loaded library cache.
@@ -1152,7 +1154,7 @@ TclFinalizeLoad(void)
if (pkgPtr->fileName[0] != '\0') {
Tcl_FSUnloadFileProc *unLoadProcPtr = pkgPtr->unLoadProcPtr;
- if (unLoadProcPtr != NULL) {
+ if ((unLoadProcPtr != NULL) && (pkgPtr->unloadProc != NULL)) {
(*unLoadProcPtr)(pkgPtr->loadHandle);
}
}