@@ -6782,31 +6782,37 @@ int openXDisplay(void)
67826782 return 0 ;
67836783}
67846784
6785- int forgetXDisplay (void )
6786- {
6787- /* Initialise variables related to the X connection, and
6788- make the existing connection to the X Display invalid
6789- for any further access from this Squeak image. Any socket
6790- connection to the X server is closed, but the server is
6791- not told to terminate any windows or X sessions. This
6792- is used to support fork() for an existing Squeak image,
6793- where the child is expected to continue as a headless
6794- image, and the parent continues its normal execution. */
67956785
6786+ static void clearXDisplayVariables ()
6787+ {
67966788 displayName = 0 ; /* name of display, or 0 for $DISPLAY */
67976789 stDisplay = null ; /* Squeak display */
6798- if (isConnectedToXServer )
6799- {
6800- if (stXfd >= 0 )
6801- aioDisable (stXfd );
6802- close (stXfd );
6803- }
68046790 stXfd = -1 ; /* X connection file descriptor */
68056791 stParent = null ;
68066792 stWindow = null ; /* Squeak window */
68076793 inputContext = 0 ;
68086794 inputFont = NULL ;
68096795 isConnectedToXServer = 0 ;
6796+ }
6797+
6798+
6799+ /* Initialise variables related to the X connection, and make the existing
6800+ * connection to the X Display invalid for any further access from this
6801+ * Squeak image. Any socket connection to the X server is closed, but the
6802+ * server is not told to terminate any windows or X sessions. This is
6803+ * used to support fork() for an existing Squeak image, where the child
6804+ * is expected to continue as a headless image, and the parent continues
6805+ * its normal execution.
6806+ */
6807+ int forgetXDisplay (void )
6808+ {
6809+ if (isConnectedToXServer )
6810+ {
6811+ if (stXfd >= 0 )
6812+ aioDisable (stXfd );
6813+ close (stXfd );
6814+ clearXDisplayVariables ();
6815+ }
68106816 return 0 ;
68116817}
68126818
@@ -6828,9 +6834,11 @@ int disconnectXDisplay(void)
68286834 }
68296835 if (inputFont )
68306836 XFreeFontSet (stDisplay , inputFont );
6837+ if (stXfd >= 0 )
6838+ aioDisable (stXfd );
68316839 XCloseDisplay (stDisplay );
6840+ clearXDisplayVariables ();
68326841 }
6833- forgetXDisplay ();
68346842 return 0 ;
68356843}
68366844
0 commit comments