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 | 3a8d7270b2eeaab9884eacc012ec968ba0b2da06 (patch) | |
| tree | 733529258b61908315d39fbceeff54406c6f075b /win32/PlatWin.cxx | |
| parent | 1be0995e0ee4ec69426ae908ae8d05603dfaa905 (diff) | |
| download | scintilla-mirror-3a8d7270b2eeaab9884eacc012ec968ba0b2da06.tar.gz | |
Add ReleaseUnknown to safely release IUnknown* and avoid warnings when done in
noexcept context.
Diffstat (limited to 'win32/PlatWin.cxx')
| -rw-r--r-- | win32/PlatWin.cxx | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 60bdbfee6..73f85e0a9 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -194,9 +194,7 @@ struct FormatAndMetrics { if (hfont) ::DeleteObject(hfont); #if defined(USE_D2D) - if (pTextFormat) - pTextFormat->Release(); - pTextFormat = nullptr; + ReleaseUnknown(pTextFormat); #endif extraFontFlag = 0; characterSet = 0; @@ -1154,10 +1152,7 @@ SurfaceD2D::~SurfaceD2D() { } void SurfaceD2D::Clear() noexcept { - if (pBrush) { - pBrush->Release(); - pBrush = nullptr; - } + ReleaseUnknown(pBrush); if (pRenderTarget) { while (clipsActive) { pRenderTarget->PopAxisAlignedClip(); @@ -1165,7 +1160,7 @@ void SurfaceD2D::Clear() noexcept { } if (ownRenderTarget) { pRenderTarget->EndDraw(); - pRenderTarget->Release(); + ReleaseUnknown(pRenderTarget); ownRenderTarget = false; } pRenderTarget = nullptr; @@ -1788,10 +1783,7 @@ ScreenLineLayout::ScreenLineLayout(const IScreenLine *screenLine) { } ScreenLineLayout::~ScreenLineLayout() { - if (textLayout) { - textLayout->Release(); - textLayout = nullptr; - } + ReleaseUnknown(textLayout); } // Get the position from the provided x |
