[SNDREC32]

do not delete objects which are still selected into a DC

svn path=/trunk/; revision=67177
This commit is contained in:
Christoph von Wittich 2015-04-12 16:29:36 +00:00
parent d0ab5ca8f8
commit fe19391da7

View file

@ -352,6 +352,7 @@ WndProc_wave(HWND hWnd,
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc; HDC hdc;
HPEN pen; HPEN pen;
HPEN oldpen;
unsigned int max_h = (cli.bottom / 2); unsigned int max_h = (cli.bottom / 2);
unsigned int samples; unsigned int samples;
@ -366,7 +367,7 @@ WndProc_wave(HWND hWnd,
/* Initialize hdc objects */ /* Initialize hdc objects */
hdc = BeginPaint(hWnd, &ps); hdc = BeginPaint(hWnd, &ps);
pen = (HPEN)CreatePen(PS_SOLID, 1, WAVEBAR_COLOR); 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) if (AUD_OUT->current_status() == snd::WAVEOUT_PLAYING)
{ {
samples = AUD_OUT->tot_samples_buf(); samples = AUD_OUT->tot_samples_buf();
@ -412,6 +413,7 @@ WndProc_wave(HWND hWnd,
LineTo(hdc, WAVEBAR_CX, cli.bottom / 2); LineTo(hdc, WAVEBAR_CX, cli.bottom / 2);
} }
SelectObject(hdc, oldpen);
DeleteObject( pen ); DeleteObject( pen );
EndPaint( hWnd, &ps ); EndPaint( hWnd, &ps );
break; break;
@ -437,6 +439,7 @@ WndProc(HWND hWnd,
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hdc; HDC hdc;
HFONT font; HFONT font;
HFONT oldfont;
long long slid_samp = 0; long long slid_samp = 0;
/* Checking for global pointers to buffer and io audio devices */ /* Checking for global pointers to buffer and io audio devices */
@ -774,7 +777,7 @@ WndProc(HWND hWnd,
case WM_PAINT: case WM_PAINT:
hdc = BeginPaint(hWnd, &ps); hdc = BeginPaint(hWnd, &ps);
font = CreateFontIndirect(&s_info.lfMenuFont); font = CreateFontIndirect(&s_info.lfMenuFont);
SelectObject(hdc, font); oldfont = (HFONT) SelectObject(hdc, font);
SetBkMode(hdc, TRANSPARENT); SetBkMode(hdc, TRANSPARENT);
if (AUD_IN->current_status() == snd::WAVEIN_RECORDING) if (AUD_IN->current_status() == snd::WAVEIN_RECORDING)
@ -877,6 +880,7 @@ WndProc(HWND hWnd,
_tcslen(str_tmp), _tcslen(str_tmp),
0); 0);
SelectObject(hdc, oldfont);
DeleteObject(font); DeleteObject(font);
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
break; break;