Bug 218832 [W] UMR: Uninitialized memory read in nsView::ConvertToParentCoords(int *,int *)const

r=roc sr=roc
This commit is contained in:
timeless%mozdev.org 2003-09-11 02:44:40 +00:00
Родитель cb29b466cc
Коммит 8a504b26c0
2 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -382,7 +382,10 @@ void nsScrollPortView::AdjustChildWidgets(nsScrollPortView *aScrolling, nsView *
if (aScrolling == aView)
{
nsIWidget *widget;
aScrolling->GetOffsetFromWidget(&aDx, &aDy, widget);
nscoord dx, dy;
aScrolling->GetOffsetFromWidget(&dx, &dy, widget);
aDx += dx;
aDy += dy;
NS_IF_RELEASE(widget);
}

Просмотреть файл

@ -883,22 +883,25 @@ NS_IMETHODIMP nsView::GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget
nsView *ancestor = GetParent();
aWidget = nsnull;
// XXX aDx and aDy are OUT parameters and so we should initialize them
// to 0 rather than relying on the caller to do so...
while (nsnull != ancestor)
if (aDx) *aDx = 0;
if (aDy) *aDy = 0;
while (ancestor)
{
aWidget = ancestor->GetWidget();
if (aWidget) {
NS_ADDREF(aWidget);
// the widget's (0,0) is at the top left of the view's bounds, NOT its position
if (aDx && aDy)
{
nsRect r;
ancestor->GetDimensions(r);
aDx -= r.x;
aDy -= r.y;
*aDx -= r.x;
*aDy -= r.y;
}
return NS_OK;
}
if ((nsnull != aDx) && (nsnull != aDy))
if (aDx && aDy)
{
ancestor->ConvertToParentCoords(aDx, aDy);
}