AddRemoveScrollbar does not always set |aHasScrollbar|

RESOLVED FIXED

Status

()

Core
Layout
RESOLVED FIXED
16 years ago
16 years ago

People

(Reporter: Andrew Schultz, Assigned: Marc Attinasi)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

16 years ago
found this with Valgrind...

http://lxr.mozilla.org/mozilla/source/layout/html/base/src/nsGfxScrollFrame.cpp#1024
1024      PRBool hasHorizontalScrollbar;
1025      PRBool fit = AddRemoveScrollbar(hasHorizontalScrollbar,
aScrollAreaSize.y, aScrollAreaSize.height, hSize.height, aOnTop, aAdd);
1026      mHasHorizontalScrollbar = hasHorizontalScrollbar;

|hasHorizontalScrollbar| is not initialized

1072    // not enough room? Yes? Return true.
1073    if (size >= aSbSize) {
1074        aHasScrollbar = aAdd;
1075        aSize = size;
1076        return PR_TRUE;
1077    }
1078 
1079    return PR_FALSE;

If (size < aSbSize), |aHasScrollbar| is returned with whatever value it had when
AddRemoveScrollbar was called (uninitialized).  The caller goes on to use the
value of |hasHorizontalScrollbar| at line 1026.

The same thing happens with |hasVerticalScrollbar|.

Comment 1

16 years ago
Andrew Schultz,
I have added a patch of attachment 95959 [details] [diff] [review] in bug 156982.
Please take a look to see whether it can fix this one. Thanks!
(Reporter)

Comment 2

16 years ago
fixed by bug 163800

thanks Pete!
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Depends on: 163800
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.