[ros-dev] [ros-diffs] [cwittich] 67177: [SNDREC32] do not delete objects which are still selected into a DC

Timo Kreuzer timo.kreuzer at web.de
Sun Apr 12 18:49:05 UTC 2015


Just for the record: it's perfectly fine and safe to do that. They will 
be kept alive as long as they are selected and will be deleted, once a 
different object is selected or the DC is deleted.

Am 12.04.2015 um 18:29 schrieb cwittich at svn.reactos.org:
> Author: cwittich
> Date: Sun Apr 12 16:29:36 2015
> New Revision: 67177
>
> URL: http://svn.reactos.org/svn/reactos?rev=67177&view=rev
> Log:
> [SNDREC32]
> do not delete objects which are still selected into a DC
>
> Modified:
>      trunk/reactos/base/applications/sndrec32/sndrec32.cpp
>
> Modified: trunk/reactos/base/applications/sndrec32/sndrec32.cpp
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sndrec32/sndrec32.cpp?rev=67177&r1=67176&r2=67177&view=diff
> ==============================================================================
> --- trunk/reactos/base/applications/sndrec32/sndrec32.cpp	[iso-8859-1] (original)
> +++ trunk/reactos/base/applications/sndrec32/sndrec32.cpp	[iso-8859-1] Sun Apr 12 16:29:36 2015
> @@ -352,6 +352,7 @@
>       PAINTSTRUCT ps;
>       HDC hdc;
>       HPEN pen;
> +    HPEN oldpen;
>   
>       unsigned int max_h = (cli.bottom / 2);
>       unsigned int samples;
> @@ -366,7 +367,7 @@
>               /* 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 @@
>                   LineTo(hdc, WAVEBAR_CX, cli.bottom  / 2);
>               }
>   
> +            SelectObject(hdc, oldpen);
>               DeleteObject( pen );
>               EndPaint( hWnd, &ps );
>               break;
> @@ -437,6 +439,7 @@
>       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 @@
>           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 @@
>                          _tcslen(str_tmp),
>                          0);
>   
> +            SelectObject(hdc, oldfont);
>               DeleteObject(font);
>               EndPaint(hWnd, &ps);
>               break;
>
>
>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3683 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.reactos.org/pipermail/ros-dev/attachments/20150412/27b42794/attachment.bin>


More information about the Ros-dev mailing list