|
13 | 13 | * Portions Copyright (c) 1994, Regents of the University of California
|
14 | 14 | *
|
15 | 15 | * IDENTIFICATION
|
16 |
| - * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.38 2002/12/30 22:10:54 tgl Exp $ |
| 16 | + * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.39 2003/02/01 00:07:03 tgl Exp $ |
17 | 17 | *
|
18 | 18 | *-------------------------------------------------------------------------
|
19 | 19 | */
|
@@ -295,17 +295,19 @@ PgDelConnectionId(DRIVER_DEL_PROTO)
|
295 | 295 | * the socket itself!
|
296 | 296 | *
|
297 | 297 | * XXX Unfortunately, while this works fine if we are closing due to
|
298 |
| - * explicit pg_disconnect, Tcl versions through 8.3.3 dump core if we |
299 |
| - * try to do it during interpreter shutdown. Not clear why, or if |
300 |
| - * there is a workaround. For now, accept leakage of the (fairly |
301 |
| - * small) amount of memory taken for the channel state representation. |
302 |
| - * Note we are not leaking a socket, since libpq closed that already. |
| 298 | + * explicit pg_disconnect, all Tcl versions through 8.4.1 dump core |
| 299 | + * if we try to do it during interpreter shutdown. Not clear why. |
| 300 | + * For now, we kill the channel during pg_disconnect, but during interp |
| 301 | + * shutdown we just accept leakage of the (fairly small) amount of memory |
| 302 | + * taken for the channel state representation. |
| 303 | + * (Note we are not leaking a socket, since libpq closed that already.) |
| 304 | + * We tell the difference between pg_disconnect and interpreter shutdown |
| 305 | + * by testing for interp != NULL, which is an undocumented but apparently |
| 306 | + * safe way to tell. |
303 | 307 | */
|
304 |
| -#ifdef NOT_USED |
305 | 308 | #if TCL_MAJOR_VERSION >= 8
|
306 |
| - if (connid->notifier_channel != NULL) |
| 309 | + if (connid->notifier_channel != NULL && interp != NULL) |
307 | 310 | Tcl_UnregisterChannel(NULL, connid->notifier_channel);
|
308 |
| -#endif |
309 | 311 | #endif
|
310 | 312 |
|
311 | 313 | /*
|
|
0 commit comments