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

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

[Dotgnu-pnet-commits] pnetlib/Xsharp Bitmap.cs, 1.4, 1.5 Drawable.cs, 1


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnetlib/Xsharp Bitmap.cs, 1.4, 1.5 Drawable.cs, 1.2, 1.3 Pixmap.cs, 1.2, 1.3 Widget.cs, 1.9, 1.10
Date: Fri, 21 Nov 2003 02:23:32 +0000

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

Modified Files:
        Bitmap.cs Drawable.cs Pixmap.cs Widget.cs 
Log Message:


Just clear the pixmap/window handle during finalization, rather than
sending a full X destroy request, to avoid deadlocks between the
main thread and the finalizer thread.


Index: Bitmap.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Bitmap.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Bitmap.cs   20 Nov 2003 10:25:20 -0000      1.4
--- Bitmap.cs   21 Nov 2003 02:23:30 -0000      1.5
***************
*** 311,314 ****
--- 311,331 ----
                        }
  
+       /// <summary>
+       /// <para>Destroy this drawable from a finalizer if it is
+       /// currently active.</para>
+       /// </summary>
+       ///
+       /// <remarks>
+       /// <para>This version is called from object finalizers.  Subclasses
+       /// need to be careful not to lock the display during finalization
+       /// because doing so can lead to deadlock conditions.</para>
+       /// </remarks>
+       public override void DestroyFromFinalizer()
+                       {
+                               // Just clear the handle: the X server will 
clean
+                               // up the pixmap object for us at shutdown.
+                               handle = Xlib.Drawable.Zero;
+                       }
+ 
        // Convert a color into a pixel value, relative to this drawable.
        // Should be called with the display lock.

Index: Widget.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Widget.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Widget.cs   21 Nov 2003 01:15:33 -0000      1.9
--- Widget.cs   21 Nov 2003 02:23:30 -0000      1.10
***************
*** 165,168 ****
--- 165,185 ----
  
        /// <summary>
+       /// <para>Destroy this drawable from a finalizer if it is
+       /// currently active.</para>
+       /// </summary>
+       ///
+       /// <remarks>
+       /// <para>This version is called from object finalizers.  Subclasses
+       /// need to be careful not to lock the display during finalization
+       /// because doing so can lead to deadlock conditions.</para>
+       /// </remarks>
+       public override void DestroyFromFinalizer()
+                       {
+                               // Just clear the handle: the X server will 
clean
+                               // up the window object for us at shutdown.
+                               handle = Xlib.Drawable.Zero;
+                       }
+ 
+       /// <summary>
        /// <para>Get the X position of this widget relative to its 
parent.</para>
        /// </summary>

Index: Pixmap.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Pixmap.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Pixmap.cs   7 Jun 2003 05:40:07 -0000       1.2
--- Pixmap.cs   21 Nov 2003 02:23:30 -0000      1.3
***************
*** 184,187 ****
--- 184,204 ----
                        }
  
+       /// <summary>
+       /// <para>Destroy this drawable from a finalizer if it is
+       /// currently active.</para>
+       /// </summary>
+       ///
+       /// <remarks>
+       /// <para>This version is called from object finalizers.  Subclasses
+       /// need to be careful not to lock the display during finalization
+       /// because doing so can lead to deadlock conditions.</para>
+       /// </remarks>
+       public override void DestroyFromFinalizer()
+                       {
+                               // Just clear the handle: the X server will 
clean
+                               // up the pixmap object for us at shutdown.
+                               handle = Xlib.Drawable.Zero;
+                       }
+ 
  } // class Pixmap
  

Index: Drawable.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Drawable.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Drawable.cs 21 Nov 2003 01:15:33 -0000      1.2
--- Drawable.cs 21 Nov 2003 02:23:30 -0000      1.3
***************
*** 56,60 ****
        ~Drawable()
                        {
!                               Destroy();
                        }
  
--- 56,60 ----
        ~Drawable()
                        {
!                               DestroyFromFinalizer();
                        }
  
***************
*** 170,173 ****
--- 170,188 ----
        /// </summary>
        public virtual void Destroy()
+                       {
+                               // Nothing to do here: overridden in subclasses.
+                       }
+ 
+       /// <summary>
+       /// <para>Destroy this drawable from a finalizer if it is
+       /// currently active.</para>
+       /// </summary>
+       ///
+       /// <remarks>
+       /// <para>This version is called from object finalizers.  Subclasses
+       /// need to be careful not to lock the display during finalization
+       /// because doing so can lead to deadlock conditions.</para>
+       /// </remarks>
+       public virtual void DestroyFromFinalizer()
                        {
                                // Nothing to do here: overridden in subclasses.





reply via email to

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