summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-09 19:18:39 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-09 19:18:39 +0300
commitfdce46bbb9b5f74237f422c55795f241d669653e (patch)
treea8f6b253aa66b6328789e5a93bd1f67606fd1e0d
parente1c1fd4eea14ca531e28415b50d35c35a840d558 (diff)
fixes #1076
-rw-r--r--src/mir_app/src/options.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp
index 7a6ba30b64..261841f39b 100644
--- a/src/mir_app/src/options.cpp
+++ b/src/mir_app/src/options.cpp
@@ -111,23 +111,25 @@ static void AeroPaintControl(HWND hwnd, HDC hdc, UINT msg, LPARAM lpFlags)
BYTE *pBits;
HBITMAP hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, (void **)&pBits, nullptr, 0);
- HBITMAP hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);
-
- // paint
- SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)TRUE);
- mir_callNextSubclass(hwnd, AeroPaintSubclassProc, msg, (WPARAM)tempDC, lpFlags);
- SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)FALSE);
-
- // Fix alpha channel
- GdiFlush();
- for (int i = 0; i < rc.right*rc.bottom; i++, pBits += 4)
- if (!pBits[3])
- pBits[3] = 255;
-
- // Copy to output
- BitBlt(hdc, 0, 0, rc.right, rc.bottom, tempDC, 0, 0, SRCCOPY);
- SelectObject(tempDC, hOldBmp);
- DeleteObject(hBmp);
+ if (hBmp && pBits) {
+ HBITMAP hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);
+
+ // paint
+ SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)TRUE);
+ mir_callNextSubclass(hwnd, AeroPaintSubclassProc, msg, (WPARAM)tempDC, lpFlags);
+ SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)FALSE);
+
+ // Fix alpha channel
+ GdiFlush();
+ for (int i = 0; i < rc.right*rc.bottom; i++, pBits += 4)
+ if (!pBits[3])
+ pBits[3] = 255;
+
+ // Copy to output
+ BitBlt(hdc, 0, 0, rc.right, rc.bottom, tempDC, 0, 0, SRCCOPY);
+ SelectObject(tempDC, hOldBmp);
+ DeleteObject(hBmp);
+ }
DeleteDC(tempDC);
}