diff options
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/PlatWin.cxx | 31 | ||||
| -rw-r--r-- | win32/PlatWin.h | 2 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 2 | ||||
| -rw-r--r-- | win32/ScintillaWin.h | 2 |
4 files changed, 12 insertions, 25 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 11dc5d3ed..080b03fc9 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1332,9 +1332,8 @@ void SurfaceD2D::D2DPenColour(ColourDesired fore, int alpha) { pBrush->SetColor(col); } else { const HRESULT hr = pRenderTarget->CreateSolidColorBrush(col, &pBrush); - if (!SUCCEEDED(hr) && pBrush) { - pBrush->Release(); - pBrush = nullptr; + if (!SUCCEEDED(hr)) { + ReleaseUnknown(pBrush); } } } @@ -3098,32 +3097,20 @@ void Platform_Initialise(void *hInstance) { ListBoxX_Register(); } -void Platform_Finalise(bool fromDllMain) { +void Platform_Finalise(bool fromDllMain) noexcept { #if defined(USE_D2D) if (!fromDllMain) { - if (defaultRenderingParams) { - defaultRenderingParams->Release(); - defaultRenderingParams = nullptr; - } - if (customClearTypeRenderingParams) { - customClearTypeRenderingParams->Release(); - customClearTypeRenderingParams = nullptr; - } - if (pIDWriteFactory) { - pIDWriteFactory->Release(); - pIDWriteFactory = nullptr; - } - if (pD2DFactory) { - pD2DFactory->Release(); - pD2DFactory = nullptr; - } + ReleaseUnknown(defaultRenderingParams); + ReleaseUnknown(customClearTypeRenderingParams); + ReleaseUnknown(pIDWriteFactory); + ReleaseUnknown(pD2DFactory); if (hDLLDWrite) { FreeLibrary(hDLLDWrite); - hDLLDWrite = NULL; + hDLLDWrite = {}; } if (hDLLD2D) { FreeLibrary(hDLLD2D); - hDLLD2D = NULL; + hDLLD2D = {}; } } #endif diff --git a/win32/PlatWin.h b/win32/PlatWin.h index 23c889d14..1a5e82f3b 100644 --- a/win32/PlatWin.h +++ b/win32/PlatWin.h @@ -15,7 +15,7 @@ namespace Scintilla { #endif extern void Platform_Initialise(void *hInstance); -extern void Platform_Finalise(bool fromDllMain); +extern void Platform_Finalise(bool fromDllMain) noexcept; RECT RectFromPRectangle(PRectangle prc) noexcept; diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 83d83daae..7e041130c 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -3620,7 +3620,7 @@ int Scintilla_RegisterClasses(void *hInstance) { namespace Scintilla { -int ResourcesRelease(bool fromDllMain) { +int ResourcesRelease(bool fromDllMain) noexcept { const bool result = ScintillaWin::Unregister(); Platform_Finalise(fromDllMain); return result; diff --git a/win32/ScintillaWin.h b/win32/ScintillaWin.h index e7cfc19ff..cce72587d 100644 --- a/win32/ScintillaWin.h +++ b/win32/ScintillaWin.h @@ -12,7 +12,7 @@ class ScintillaWin; namespace Scintilla { -int ResourcesRelease(bool fromDllMain); +int ResourcesRelease(bool fromDllMain) noexcept; sptr_t DirectFunction(ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam); } |
