mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 20:59:54 +00:00
comctl32: Fix possible use of uninitialised variable in REBAR_Paint.
In the case where an hdc is passed in via the wParam, ps.fErase could be uninitialised. Fix this by rearranging the code so that ps is only used when an hdc isn't passed in.
This commit is contained in:
parent
4e0100ff06
commit
f3c40f925d
@ -3197,24 +3197,23 @@ REBAR_NotifyFormat (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
||||
static LRESULT
|
||||
REBAR_Paint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
RECT rc;
|
||||
HDC hdc = (HDC)wParam;
|
||||
|
||||
GetClientRect(infoPtr->hwndSelf, &rc);
|
||||
hdc = wParam==0 ? BeginPaint (infoPtr->hwndSelf, &ps) : (HDC)wParam;
|
||||
|
||||
TRACE("painting (%s) client (%s)\n",
|
||||
wine_dbgstr_rect(&ps.rcPaint), wine_dbgstr_rect(&rc));
|
||||
|
||||
if (ps.fErase) {
|
||||
/* Erase area of paint if requested */
|
||||
REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint);
|
||||
if (hdc) {
|
||||
TRACE("painting\n");
|
||||
REBAR_Refresh (infoPtr, hdc);
|
||||
} else {
|
||||
PAINTSTRUCT ps;
|
||||
hdc = BeginPaint (infoPtr->hwndSelf, &ps);
|
||||
TRACE("painting (%s)\n", wine_dbgstr_rect(&ps.rcPaint));
|
||||
if (ps.fErase) {
|
||||
/* Erase area of paint if requested */
|
||||
REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint);
|
||||
}
|
||||
REBAR_Refresh (infoPtr, hdc);
|
||||
EndPaint (infoPtr->hwndSelf, &ps);
|
||||
}
|
||||
|
||||
REBAR_Refresh (infoPtr, hdc);
|
||||
if (!wParam)
|
||||
EndPaint (infoPtr->hwndSelf, &ps);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user