From fe19391da71989da382cfe2732f095df69d7403b Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sun, 12 Apr 2015 16:29:36 +0000 Subject: [PATCH] [SNDREC32] do not delete objects which are still selected into a DC svn path=/trunk/; revision=67177 --- reactos/base/applications/sndrec32/sndrec32.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/reactos/base/applications/sndrec32/sndrec32.cpp b/reactos/base/applications/sndrec32/sndrec32.cpp index f05a0dd5538..d43ef786ce6 100644 --- a/reactos/base/applications/sndrec32/sndrec32.cpp +++ b/reactos/base/applications/sndrec32/sndrec32.cpp @@ -352,6 +352,7 @@ WndProc_wave(HWND hWnd, PAINTSTRUCT ps; HDC hdc; HPEN pen; + HPEN oldpen; unsigned int max_h = (cli.bottom / 2); unsigned int samples; @@ -366,7 +367,7 @@ WndProc_wave(HWND hWnd, /* Initialize hdc objects */ hdc = BeginPaint(hWnd, &ps); pen = (HPEN)CreatePen(PS_SOLID, 1, WAVEBAR_COLOR); - SelectObject(hdc, (HBRUSH)pen); + oldpen = (HPEN) SelectObject(hdc, (HBRUSH)pen); if (AUD_OUT->current_status() == snd::WAVEOUT_PLAYING) { samples = AUD_OUT->tot_samples_buf(); @@ -412,6 +413,7 @@ WndProc_wave(HWND hWnd, LineTo(hdc, WAVEBAR_CX, cli.bottom / 2); } + SelectObject(hdc, oldpen); DeleteObject( pen ); EndPaint( hWnd, &ps ); break; @@ -437,6 +439,7 @@ WndProc(HWND hWnd, PAINTSTRUCT ps; HDC hdc; HFONT font; + HFONT oldfont; long long slid_samp = 0; /* Checking for global pointers to buffer and io audio devices */ @@ -774,7 +777,7 @@ WndProc(HWND hWnd, case WM_PAINT: hdc = BeginPaint(hWnd, &ps); font = CreateFontIndirect(&s_info.lfMenuFont); - SelectObject(hdc, font); + oldfont = (HFONT) SelectObject(hdc, font); SetBkMode(hdc, TRANSPARENT); if (AUD_IN->current_status() == snd::WAVEIN_RECORDING) @@ -877,6 +880,7 @@ WndProc(HWND hWnd, _tcslen(str_tmp), 0); + SelectObject(hdc, oldfont); DeleteObject(font); EndPaint(hWnd, &ps); break;