aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--win32/PlatWin.cxx31
-rw-r--r--win32/PlatWin.h2
-rw-r--r--win32/ScintillaWin.cxx2
-rw-r--r--win32/ScintillaWin.h2
4 files changed, 12 insertions, 25 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index a71b68c57..11db37a6a 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -1341,9 +1341,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);
}
}
}
@@ -3501,32 +3500,20 @@ void Platform_Initialise(void *hInstance) noexcept {
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 0d1c99b48..eb4bfb556 100644
--- a/win32/PlatWin.h
+++ b/win32/PlatWin.h
@@ -16,7 +16,7 @@ namespace Scintilla {
extern void Platform_Initialise(void *hInstance) noexcept;
-extern void Platform_Finalise(bool fromDllMain);
+extern void Platform_Finalise(bool fromDllMain) noexcept;
constexpr RECT RectFromPRectangle(PRectangle prc) noexcept {
RECT rc = { static_cast<LONG>(prc.left), static_cast<LONG>(prc.top),
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index a0d1c024b..01eb13883 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -3557,7 +3557,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);
}