diff options
| author | Zufu Liu <unknown> | 2020-06-15 10:20:23 +1000 | 
|---|---|---|
| committer | Zufu Liu <unknown> | 2020-06-15 10:20:23 +1000 | 
| commit | 7bdbad1346fa2d34ab37d7fd7d1574b78f879b6f (patch) | |
| tree | cdc2677d03875b4604fb661c3ad2f5f50ca3d921 | |
| parent | 5ebd653f630d2f37c696f7f6928de4fa133b8486 (diff) | |
| download | scintilla-mirror-7bdbad1346fa2d34ab37d7fd7d1574b78f879b6f.tar.gz | |
Backport: Use ReleaseUnknown to extend noexcept over finalisation.
Backport of changeset 8305:986abc429f9a.
| -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);  } | 
