Tcl Source Code

Check-in [343281a570]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix for issue [463b7a93be0a2ddd], Tcl_Unload, make gdb-test, segmentation fault
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-463b7a93be0a2ddd
Files: files | file ages | folders
SHA3-256: 343281a570d476616ab86fb1664263ac7ffb8ab4ae4a96b2f273a97a399cf091
User & Date: pooryorick 2021-05-14 18:50:33
References
2021-05-14
18:52 Ticket [463b7a93be] Tcl_Unload, make gdb-test, segmentation fault status still Open with 3 other changes artifact: fdbf00aeae user: pooryorick
Context
2021-05-15
09:09
Fix for issue [463b7a93be0a2ddd], Tcl_Unload, make gdb-test, segmentation fault. check-in: 7ffa017f9b user: pooryorick tags: core-8-branch
2021-05-14
18:50
Fix for issue [463b7a93be0a2ddd], Tcl_Unload, make gdb-test, segmentation fault Closed-Leaf check-in: 343281a570 user: pooryorick tags: bug-463b7a93be0a2ddd
13:54
Respect TIP #587 in dde test-cases. check-in: 45fa0ff557 user: jan.nijtmans tags: core-8-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclLoad.c.

799
800
801
802
803
804
805

























806
807
808
809
810
811
812
	}
    }
    code = unloadProc(target, code);
    if (code != TCL_OK) {
	Tcl_TransferResult(target, code, interp);
	goto done;
    }


























    /*
     * The unload function executed fine. Examine the reference count to see
     * if we unload the DLL.
     */

    Tcl_MutexLock(&libraryMutex);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
	}
    }
    code = unloadProc(target, code);
    if (code != TCL_OK) {
	Tcl_TransferResult(target, code, interp);
	goto done;
    }


    /*
     * Remove this library from the interpreter's library cache.
     */

    ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(target, "tclLoad", NULL);
    ipPtr = ipFirstPtr;
    if (ipPtr->libraryPtr == libraryPtr) {
	ipFirstPtr = ipFirstPtr->nextPtr;
    } else {
	InterpLibrary *ipPrevPtr;

	for (ipPrevPtr = ipPtr; ipPtr != NULL;
		ipPrevPtr = ipPtr, ipPtr = ipPtr->nextPtr) {
	    if (ipPtr->libraryPtr == libraryPtr) {
		ipPrevPtr->nextPtr = ipPtr->nextPtr;
		break;
	    }
	}
    }
    Tcl_SetAssocData(target, "tclLoad", LoadCleanupProc,
	    ipFirstPtr);



    /*
     * The unload function executed fine. Examine the reference count to see
     * if we unload the DLL.
     */

    Tcl_MutexLock(&libraryMutex);
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
			if (libraryPtr->nextPtr == defaultPtr) {
			    libraryPtr->nextPtr = defaultPtr->nextPtr;
			    break;
			}
		    }
		}

		/*
		 * Remove this library from the interpreter's library cache.
		 */

		ipFirstPtr = (InterpLibrary *)Tcl_GetAssocData(target, "tclLoad", NULL);
		ipPtr = ipFirstPtr;
		if (ipPtr->libraryPtr == defaultPtr) {
		    ipFirstPtr = ipFirstPtr->nextPtr;
		} else {
		    InterpLibrary *ipPrevPtr;

		    for (ipPrevPtr = ipPtr; ipPtr != NULL;
			    ipPrevPtr = ipPtr, ipPtr = ipPtr->nextPtr) {
			if (ipPtr->libraryPtr == defaultPtr) {
			    ipPrevPtr->nextPtr = ipPtr->nextPtr;
			    break;
			}
		    }
		}
		Tcl_SetAssocData(target, "tclLoad", LoadCleanupProc,
			ipFirstPtr);
		ckfree(defaultPtr->fileName);
		ckfree(defaultPtr->prefix);
		ckfree(defaultPtr);
		ckfree(ipPtr);
		Tcl_MutexUnlock(&libraryMutex);
	    } else {
		code = TCL_ERROR;







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







891
892
893
894
895
896
897





















898
899
900
901
902
903
904
			if (libraryPtr->nextPtr == defaultPtr) {
			    libraryPtr->nextPtr = defaultPtr->nextPtr;
			    break;
			}
		    }
		}






















		ckfree(defaultPtr->fileName);
		ckfree(defaultPtr->prefix);
		ckfree(defaultPtr);
		ckfree(ipPtr);
		Tcl_MutexUnlock(&libraryMutex);
	    } else {
		code = TCL_ERROR;