diff options
| author | Neil <nyamatongwe@gmail.com> | 2020-06-06 13:41:58 +1000 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2020-06-06 13:41:58 +1000 |
| commit | 554d1cc7c885291618ec50b6045e27fc1cf87a28 (patch) | |
| tree | 85b548fe63cc42a1487ad8f8122d341bcdad9138 /win32/PlatWin.cxx | |
| parent | f1f8eeddbe3437c3e3f4f4580435996ea3cd0904 (diff) | |
| download | scintilla-mirror-554d1cc7c885291618ec50b6045e27fc1cf87a28.tar.gz | |
Backport: Add ReleaseUnknown to safely release IUnknown* and avoid warnings when done in
noexcept context.
Backport of changeset 8286:bddda9b7df4f.
Diffstat (limited to 'win32/PlatWin.cxx')
| -rw-r--r-- | win32/PlatWin.cxx | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 75d420068..9d5d32141 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -199,9 +199,7 @@ struct FormatAndMetrics { if (hfont) ::DeleteObject(hfont); #if defined(USE_D2D) - if (pTextFormat) - pTextFormat->Release(); - pTextFormat = nullptr; + ReleaseUnknown(pTextFormat); #endif extraFontFlag = 0; characterSet = 0; @@ -1143,10 +1141,7 @@ SurfaceD2D::~SurfaceD2D() { } void SurfaceD2D::Clear() noexcept { - if (pBrush) { - pBrush->Release(); - pBrush = nullptr; - } + ReleaseUnknown(pBrush); if (pRenderTarget) { while (clipsActive) { pRenderTarget->PopAxisAlignedClip(); @@ -1154,7 +1149,7 @@ void SurfaceD2D::Clear() noexcept { } if (ownRenderTarget) { pRenderTarget->EndDraw(); - pRenderTarget->Release(); + ReleaseUnknown(pRenderTarget); ownRenderTarget = false; } pRenderTarget = nullptr; |
