Index: generic/tclInt.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.h,v
retrieving revision 1.121
diff -u -r1.121 tclInt.h
--- generic/tclInt.h	20 Mar 2003 22:33:44 -0000	1.121
+++ generic/tclInt.h	21 Mar 2003 02:33:28 -0000
@@ -1542,6 +1542,7 @@
 extern Tcl_ChannelType		tclFileChannelType;
 extern char *			tclMemDumpFileName;
 extern TclPlatformType		tclPlatform;
+extern Tcl_NotifierProcs	tclOriginalNotifier;
 
 /*
  * Variables denoting the Tcl object types defined in the core.
Index: generic/tclStubInit.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclStubInit.c,v
retrieving revision 1.79
diff -u -r1.79 tclStubInit.c
--- generic/tclStubInit.c	18 Feb 2003 02:25:45 -0000	1.79
+++ generic/tclStubInit.c	21 Mar 2003 02:33:28 -0000
@@ -37,6 +37,29 @@
 #endif
 
 /*
+ * Keep a record of the original Notifier procedures, created in the
+ * same compilation unit as the stub tables so we can later do reliable,
+ * portable comparisons to see whether a Tcl_SetNotifier() call swapped
+ * new routines into the stub table.
+ */
+
+Tcl_NotifierProcs tclOriginalNotifier = {
+    Tcl_SetTimer,
+    Tcl_WaitForEvent,
+#if defined( MAC_TCL ) || defined( __WIN32__ )
+    NULL,
+    NULL,
+#else
+    Tcl_CreateFileHandler,
+    Tcl_DeleteFileHandler,
+#endif
+    Tcl_InitNotifier,
+    Tcl_FinalizeNotifier,
+    Tcl_AlertNotifier,
+    Tcl_ServiceModeHook
+};
+
+/*
  * WARNING: The contents of this file is automatically generated by the
  * tools/genStubs.tcl script. Any modifications to the function declarations
  * below should be made in the generic/tcl.decls script.
Index: mac/tclMacNotify.c
===================================================================
RCS file: /cvsroot/tcl/tcl/mac/tclMacNotify.c,v
retrieving revision 1.8
diff -u -r1.8 tclMacNotify.c
--- mac/tclMacNotify.c	23 Nov 2001 01:27:53 -0000	1.8
+++ mac/tclMacNotify.c	21 Mar 2003 02:33:28 -0000
@@ -48,6 +48,7 @@
  */
  
 extern TclStubs tclStubs;
+extern Tcl_NotifierProcs tclOriginalNotifier;
 
 /*
  * The follwing static indicates whether this module has been initialized.
@@ -339,7 +340,7 @@
      * on the Mac, but mirrors the UNIX hook.
      */
 
-    if (tclStubs.tcl_SetTimer != Tcl_SetTimer) {
+    if (tclStubs.tcl_SetTimer != tclOriginalNotifier.setTimerProc) {
 	tclStubs.tcl_SetTimer(timePtr);
 	return;
     }
@@ -420,7 +421,7 @@
      * sense on the Mac, but mirrors the UNIX hook.
      */
 
-    if (tclStubs.tcl_WaitForEvent != Tcl_WaitForEvent) {
+    if (tclStubs.tcl_WaitForEvent != tclOriginalNotifier.waitForEventProc) {
 	return tclStubs.tcl_WaitForEvent(timePtr);
     }
 
Index: unix/tclUnixNotfy.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixNotfy.c,v
retrieving revision 1.11
diff -u -r1.11 tclUnixNotfy.c
--- unix/tclUnixNotfy.c	31 Aug 2002 06:09:46 -0000	1.11
+++ unix/tclUnixNotfy.c	21 Mar 2003 02:33:28 -0000
@@ -19,6 +19,7 @@
 #include <signal.h> 
 
 extern TclStubs tclStubs;
+extern Tcl_NotifierProcs tclOriginalNotifier;
 
 /*
  * This structure is used to keep track of the notifier info for a 
@@ -353,7 +354,7 @@
      * timeout values to Tcl_WaitForEvent.
      */
 
-    if (tclStubs.tcl_SetTimer != Tcl_SetTimer) {
+    if (tclStubs.tcl_SetTimer != tclOriginalNotifier.setTimerProc) {
 	tclStubs.tcl_SetTimer(timePtr);
     }
 }
@@ -412,7 +413,7 @@
     FileHandler *filePtr;
     int index, bit;
 
-    if (tclStubs.tcl_CreateFileHandler != Tcl_CreateFileHandler) {
+    if (tclStubs.tcl_CreateFileHandler != tclOriginalNotifier.createFileHandlerProc) {
 	tclStubs.tcl_CreateFileHandler(fd, mask, proc, clientData);
 	return;
     }
@@ -486,7 +487,7 @@
     unsigned long flags;
     ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
 
-    if (tclStubs.tcl_DeleteFileHandler != Tcl_DeleteFileHandler) {
+    if (tclStubs.tcl_DeleteFileHandler != tclOriginalNotifier.deleteFileHandlerProc) {
 	tclStubs.tcl_DeleteFileHandler(fd);
 	return;
     }
@@ -662,7 +663,7 @@
 #endif
     ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
 
-    if (tclStubs.tcl_WaitForEvent != Tcl_WaitForEvent) {
+    if (tclStubs.tcl_WaitForEvent != tclOriginalNotifier.waitForEventProc) {
 	return tclStubs.tcl_WaitForEvent(timePtr);
     }
 
Index: win/tclWinNotify.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinNotify.c,v
retrieving revision 1.11
diff -u -r1.11 tclWinNotify.c
--- win/tclWinNotify.c	16 Jan 2003 19:02:00 -0000	1.11
+++ win/tclWinNotify.c	21 Mar 2003 02:33:28 -0000
@@ -45,6 +45,8 @@
 static Tcl_ThreadDataKey dataKey;
 
 extern TclStubs tclStubs;
+extern Tcl_NotifierProcs tclOriginalNotifier;
+
 /*
  * The following static indicates the number of threads that have
  * initialized notifiers.  It controls the lifetime of the TclNotifier
@@ -267,7 +269,7 @@
      * on Windows, but mirrors the UNIX hook.
      */
 
-    if (tclStubs.tcl_SetTimer != Tcl_SetTimer) {
+    if (tclStubs.tcl_SetTimer != tclOriginalNotifier.setTimerProc) {
 	tclStubs.tcl_SetTimer(timePtr);
 	return;
     }
@@ -433,7 +435,7 @@
      * sense on windows, but mirrors the UNIX hook.
      */
 
-    if (tclStubs.tcl_WaitForEvent != Tcl_WaitForEvent) {
+    if (tclStubs.tcl_WaitForEvent != tclOriginalNotifier.waitForEventProc) {
 	return tclStubs.tcl_WaitForEvent(timePtr);
     }
 
