From 598937eb19deff8732d70a2f07ff3c09c7a06fb2 Mon Sep 17 00:00:00 2001 From: amaitland Date: Fri, 26 Jun 2015 16:52:59 +1000 Subject: [PATCH] Cleanup Finalizer/Dispose for BrowserSettings and CefSettings --- CefSharp.Core/BrowserSettings.h | 14 +++++++++++--- CefSharp.Core/CefSettings.h | 11 +++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CefSharp.Core/BrowserSettings.h b/CefSharp.Core/BrowserSettings.h index 5df5715f4..43b8b8c33 100644 --- a/CefSharp.Core/BrowserSettings.h +++ b/CefSharp.Core/BrowserSettings.h @@ -80,9 +80,17 @@ namespace CefSharp CefBrowserSettings* _browserSettings; public: - BrowserSettings() : _browserSettings(new CefBrowserSettings()), _isFinalized(false) { } - !BrowserSettings() { delete _browserSettings; _isFinalized = true; } - ~BrowserSettings() { if (!_isFinalized) this->!BrowserSettings(); } + BrowserSettings() : _browserSettings(new CefBrowserSettings()) { } + + !BrowserSettings() + { + delete _browserSettings; + } + + ~BrowserSettings() + { + this->!BrowserSettings(); + } property String^ StandardFontFamily { diff --git a/CefSharp.Core/CefSettings.h b/CefSharp.Core/CefSettings.h index d3e889864..3599100f9 100644 --- a/CefSharp.Core/CefSettings.h +++ b/CefSharp.Core/CefSettings.h @@ -32,8 +32,15 @@ namespace CefSharp _cefCommandLineArgs = gcnew Dictionary(); } - !CefSettings() { delete _cefSettings; } - ~CefSettings() { delete _cefSettings; } + !CefSettings() + { + delete _cefSettings; + } + + ~CefSettings() + { + this->!CefSettings(); + } virtual property IEnumerable^ CefCustomSchemes {