dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnetlib/Xsharp EmbeddedApplication.cs, 1.4, 1.5 Wi


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnetlib/Xsharp EmbeddedApplication.cs, 1.4, 1.5 Widget.cs, 1.7, 1.8
Date: Sat, 01 Nov 2003 03:30:25 +0000

Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv22676/Xsharp

Modified Files:
        EmbeddedApplication.cs Widget.cs 
Log Message:


Make the shutdown process on embedded applications more predictable,
to avoid X server crashes.


Index: EmbeddedApplication.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/EmbeddedApplication.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** EmbeddedApplication.cs      1 Nov 2003 01:22:32 -0000       1.4
--- EmbeddedApplication.cs      1 Nov 2003 03:30:23 -0000       1.5
***************
*** 68,71 ****
--- 68,72 ----
        private AppGroupWidget groupWrapper;
        private Xlib.Window child;
+       private bool closeEventSent;
        private bool closeNotifySent;
        private static bool errorReported;
***************
*** 240,248 ****
        private void ChildDestroyed()
                        {
                                child = Xlib.Window.Zero;
!                               if(!(process.HasExited))
                                {
!                                       process.WaitForExit();
                                }
                                if(authorityFile != null)
                                {
--- 241,272 ----
        private void ChildDestroyed()
                        {
+                               // Clear the child window and destroy the 
application group.
                                child = Xlib.Window.Zero;
!                               try
                                {
!                                       IntPtr d = dpy.Lock();
!                                       if(group != Xlib.XAppGroup.Zero)
!                                       {
!                                               
Xlib.XagDestroyApplicationGroup(d, group);
!                                               group = Xlib.XAppGroup.Zero;
!                                       }
!                               }
!                               finally
!                               {
!                                       dpy.Unlock();
!                               }
! 
!                               // Wait for the child process to exit properly.
!                               if(process != null && !(process.HasExited))
!                               {
!                                       if(!process.WaitForExit(5000))
!                                       {
!                                               // Process is still alive!  
Kill it the hard way.
!                                               process.Kill();
!                                               process = null;
!                                       }
                                }
+ 
+                               // Delete the authority file, which we no 
longer require.
                                if(authorityFile != null)
                                {
***************
*** 250,253 ****
--- 274,279 ----
                                        authorityFile = null;
                                }
+ 
+                               // Notify subclasses that the child was 
destroyed.
                                if(!closeNotifySent)
                                {
***************
*** 257,268 ****
                        }
  
!       /// <summary>
!       /// <para>Destroy this widget if it is currently active.</para>
!       /// </summary>
!       public override void Destroy()
                        {
                                try
                                {
                                        IntPtr d = dpy.Lock();
                                        if(group != Xlib.XAppGroup.Zero)
                                        {
--- 283,304 ----
                        }
  
!       // Disassociate this widget instance and all of its children
!       // from their X window handles, as the mirror copy in the X
!       // server has been lost.
!       internal override void Disassociate()
                        {
+                               // Perform the basic disassociation tasks first.
+                               base.Disassociate();
+ 
+                               // Send a close message and destroy the 
application group.
                                try
                                {
                                        IntPtr d = dpy.Lock();
+                                       if(child != Xlib.Window.Zero && 
!closeEventSent)
+                                       {
+                                               closeEventSent = true;
+                                               Xlib.XSharpSendClose(d, child);
+                                               Xlib.XFlush(d);
+                                       }
                                        if(group != Xlib.XAppGroup.Zero)
                                        {
***************
*** 275,280 ****
                                        dpy.Unlock();
                                }
                                ChildDestroyed();
-                               base.Destroy();
                        }
  
--- 311,317 ----
                                        dpy.Unlock();
                                }
+ 
+                               // Clean up the child process.
                                ChildDestroyed();
                        }
  
***************
*** 297,303 ****
                                {
                                        IntPtr display = dpy.Lock();
!                                       if(child != Xlib.Window.Zero)
                                        {
                                                Xlib.XSharpSendClose(display, 
child);
                                        }
                                }
--- 334,342 ----
                                {
                                        IntPtr display = dpy.Lock();
!                                       if(child != Xlib.Window.Zero && 
!closeEventSent)
                                        {
+                                               closeEventSent = true;
                                                Xlib.XSharpSendClose(display, 
child);
+                                               Xlib.XFlush(display);
                                        }
                                }
***************
*** 330,333 ****
--- 369,373 ----
                                {
                                        process.Kill();
+                                       process = null;
                                        ChildDestroyed();
                                }

Index: Widget.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Widget.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Widget.cs   24 Jun 2003 11:10:02 -0000      1.7
--- Widget.cs   1 Nov 2003 03:30:23 -0000       1.8
***************
*** 124,128 ****
        // from their X window handles, as the mirror copy in the X
        // server has been lost.
!       internal void Disassociate()
                        {
                                if(handle != Xlib.Drawable.Zero)
--- 124,128 ----
        // from their X window handles, as the mirror copy in the X
        // server has been lost.
!       internal virtual void Disassociate()
                        {
                                if(handle != Xlib.Drawable.Zero)
***************
*** 153,158 ****
                                        if(handle != Xlib.Drawable.Zero)
                                        {
!                                               Xlib.XDestroyWindow(d, 
(Xlib.Window)handle);
                                                Disassociate();
                                        }
                                }
--- 153,159 ----
                                        if(handle != Xlib.Drawable.Zero)
                                        {
!                                               Xlib.Drawable tempHandle = 
handle;
                                                Disassociate();
+                                               Xlib.XDestroyWindow(d, 
(Xlib.Window)tempHandle);
                                        }
                                }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]