On Thursday 22 February 2007 14:55, Daniel Gehriger wrote:
> Jeroen,
>
> I ran BoundsChecker on FOX 1.6.4 and it found a few resource errors that
> still seem to exist in the latest 1.6.x.
>
> Basically, they all are due to a sequence like this:
>
> SelectObject(hdcmsk,(HBITMAP)shape);
> ...
> ::DeleteDC(hdcmsk);
>
>
> This should be:
>
> HGDIOBJ oldObj = ::SelectObject(hdcmsk,(HBITMAP)shape);
> ...
> ::SelectObject(hdcmsk,oldObj);
> ::DeleteDC(hdcmsk);
>
>
> The locations of the detected errors ("<<<<<<<<<") are:
>
> ================
> FXIcon.cpp, line 496:
>
> BitBlt(hdcmem,0,0,width,height,hdcmsk,0,0,SRCAND);
> SelectObject(hdcmem,hbm);
> ::DeleteDC(hdcmem);
> ::DeleteDC(hdcmsk); // <<<<<<<<<<
> }
> }
> }
>
> ================
> FXDCWindow.cpp, line 2015 and 2019:
>
> COLORREF crOldText=SetTextColor((HDC)ctx,RGB(0,0,0));
>
> BitBlt((HDC)ctx,dx,dy,icon->getWidth(),icon->getHeight(),hdcMsk,0,0,SRCAND);
>
> BitBlt((HDC)ctx,dx,dy,icon->getWidth(),icon->getHeight(),hdcSrc,0,0,SRCPAINT);
> DeleteDC(hdcMsk); // <<<<<<<<<<<<<<
> SetBkColor((HDC)ctx,crOldBack);
> SetTextColor((HDC)ctx,crOldText);
> }
> icon->ReleaseDC(hdcSrc); // <<<<<<<<<<<<
> }
>
> ================
> FXDCWindow.cpp, line 1512:
>
> // Release it
> int FXWindow::ReleaseDC(FXID hdc) const {
> return ::ReleaseDC((HWND)xid,(HDC)hdc); // <<<<<<<<<<<<
> }
>
> ================
> FXDCWindow.cpp, line 2092 and 2098:
>
> // Now BitBlt the black bits in the monochrome bitmap into the
> // shadow color on the destination DC.
>
> BitBlt((HDC)ctx,dx,dy,icon->getWidth(),icon->getHeight(),hdcMono,0,0,0xB8074A);
> DeleteDC(hdcMono); // <<<<<<<<<<<<
> SelectObject((HDC)ctx,oldBrush);
> DeleteObject(hbrHilite);
> DeleteObject(hbrShadow);
> SetBkColor((HDC)ctx,crOldBack);
> SetTextColor((HDC)ctx,crOldText);
> icon->ReleaseDC(hdcSrc); // <<<<<<<<<<<<
> }
>
> ================
Thanks very much; I'll have them fixed in FOX 1.6.24 patch release.
Regards,
- Jeroen
|