Author: andreia
Date: 2007-02-16 18:11:30 -0500 (Fri, 16 Feb 2007)
New Revision: 73049
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs
Log:
2007-02-16 Andreia Gaita <[EMAIL PROTECTED]>
* PrintPreviewControl/PrintPreviewDialog: Properly dispose of
print preview images.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-02-16 23:10:35 UTC (rev 73048)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-02-16 23:11:30 UTC (rev 73049)
@@ -1,3 +1,8 @@
+2007-02-16 Andreia Gaita <[EMAIL PROTECTED]>
+
+ * PrintPreviewControl/PrintPreviewDialog: Properly dispose of
+ print preview images.
+
2007-02-16 Jackson Harper <[EMAIL PROTECTED]>
* ListView.cs: Make AfterLabelEdit work correctly.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs
2007-02-16 23:10:35 UTC (rev 73048)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewControl.cs
2007-02-16 23:11:30 UTC (rev 73049)
@@ -185,12 +185,14 @@
#region Public Instance Methods
internal void GeneratePreview ()
{
+ if (document == null)
+ return;
+
try {
- if (document == null)
- return;
-
if (page_infos == null) {
- document.PrintController = new
PrintControllerWithStatusDialog (controller);
+ if (document.PrintController == null ||
!(document.PrintController is PrintControllerWithStatusDialog)) {
+ document.PrintController = new
PrintControllerWithStatusDialog (controller);
+ }
document.Print ();
page_infos =
controller.GetPreviewPageInfo ();
}
@@ -223,8 +225,21 @@
public void InvalidatePreview()
{
- page_infos = null;
- image_cache = null;
+ if (page_infos != null) {
+ for (int i = 0; i < page_infos.Length; i++) {
+ if (page_infos[i].Image != null) {
+ page_infos[i].Image.Dispose();
+ }
+ }
+ page_infos = null;
+ }
+ if (image_cache != null) {
+ for (int i = 0; i < image_cache.Length; i++) {
+ if (image_cache[i] !=null)
+ image_cache[i].Dispose();
+ }
+ image_cache = null;
+ }
}
[EditorBrowsable(EditorBrowsableState.Never)]
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs
2007-02-16 23:10:35 UTC (rev 73048)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintPreviewDialog.cs
2007-02-16 23:11:30 UTC (rev 73049)
@@ -788,6 +788,7 @@
}
protected override void OnClosing(CancelEventArgs e) {
+ print_preview.InvalidatePreview ();
base.OnClosing (e);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches