diff --git a/Desktop/DirectWrite/CustomFont/CustomFont.Designer.cs b/Desktop/DirectWrite/CustomFont/CustomFont.Designer.cs
index ef62ff4f..3a89d666 100644
--- a/Desktop/DirectWrite/CustomFont/CustomFont.Designer.cs
+++ b/Desktop/DirectWrite/CustomFont/CustomFont.Designer.cs
@@ -7,19 +7,6 @@ partial class CustomFont
///
private System.ComponentModel.IContainer components = null;
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
#region Windows Form Designer generated code
///
diff --git a/Desktop/DirectWrite/CustomFont/CustomFont.cs b/Desktop/DirectWrite/CustomFont/CustomFont.cs
index 3534ba0d..68aa3496 100644
--- a/Desktop/DirectWrite/CustomFont/CustomFont.cs
+++ b/Desktop/DirectWrite/CustomFont/CustomFont.cs
@@ -218,5 +218,22 @@ private void comboBoxFonts_SelectedIndexChanged(object sender, EventArgs e)
}
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ if (components != null)
+ {
+ components.Dispose();
+ }
+
+ CurrentResourceFontLoader.Dispose();
+ }
+ base.Dispose(disposing);
+ }
}
}
diff --git a/Desktop/DirectWrite/CustomFont/ResourceFontLoader.cs b/Desktop/DirectWrite/CustomFont/ResourceFontLoader.cs
index ac5647ec..27d1e4a6 100644
--- a/Desktop/DirectWrite/CustomFont/ResourceFontLoader.cs
+++ b/Desktop/DirectWrite/CustomFont/ResourceFontLoader.cs
@@ -110,5 +110,20 @@ FontFileStream FontFileLoader.CreateStreamFromKey(DataPointer fontFileReferenceK
var index = Utilities.Read(fontFileReferenceKey.Pointer);
return _fontStreams[index];
}
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ _factory.UnregisterFontFileLoader(this);
+ _factory.UnregisterFontCollectionLoader(this);
+ }
+
+ base.Dispose(disposing);
+ }
}
}
\ No newline at end of file