Author: spouliot
Date: 2006-05-18 17:00:05 -0400 (Thu, 18 May 2006)
New Revision: 60836

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs
Log:
2006-05-18  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * PaintEventArgs.cs: For 2.0, check for a null Graphics in the .ctor. 
        Don't set the disposed graphics to null, so we can throw the "right"
        exception if the graphics is reused later (added a flag to avoid 
        double disposing). Some behaviours are different under 2.0 and are
        filled under bug #78448.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-05-18 20:43:20 UTC (rev 60835)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-05-18 21:00:05 UTC (rev 60836)
@@ -1,3 +1,11 @@
+2006-05-18  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * PaintEventArgs.cs: For 2.0, check for a null Graphics in the .ctor. 
+       Don't set the disposed graphics to null, so we can throw the "right"
+       exception if the graphics is reused later (added a flag to avoid 
+       double disposing). Some behaviours are different under 2.0 and are
+       filled under bug #78448.
+
 2006-05-18  Peter Dennis Bartok  <[EMAIL PROTECTED]>
 
        * Control.cs: When double-buffering is enabled, we need to reset

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs    
    2006-05-18 20:43:20 UTC (rev 60835)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PaintEventArgs.cs    
    2006-05-18 21:00:05 UTC (rev 60836)
@@ -33,9 +33,15 @@
                private Graphics        graphics;
                private Rectangle       clip_rectangle;
                internal bool           Handled;
+               private bool            disposed;
                
                #region Public Constructors
-               public PaintEventArgs(System.Drawing.Graphics graphics, 
System.Drawing.Rectangle clipRect) {
+               public PaintEventArgs (Graphics graphics, Rectangle clipRect)
+               {
+#if NET_2_0
+                       if (graphics == null)
+                               throw new ArgumentNullException ("graphics");
+#endif
                        this.graphics=graphics;
                        this.clip_rectangle=clipRect;
                }
@@ -76,10 +82,12 @@
                        Dispose(false);
                }
 
-               protected virtual void Dispose(bool disposing) {
-                       if (this.graphics!=null) {
-                               graphics.Dispose();
-                               this.graphics=null;
+               protected virtual void Dispose (bool disposing)
+               {
+                       if (!disposed) {
+                               if (graphics != null)
+                                       graphics.Dispose ();
+                               disposed = true;
                        }
                }
                #endregion      // Protected Instance Methods

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to