fixing tests to use the enumerator correctly

This commit is contained in:
mjudge%netscape.com 1998-12-01 17:58:50 +00:00
parent 43d3cd4a56
commit ab27bd9d39
2 changed files with 15 additions and 13 deletions

View File

@ -106,11 +106,10 @@ nsEventStatus PR_CALLBACK HandleEventMain(nsGUIEvent *aEvent)
{
nsIEnumerator *enumer = aEvent->widget->GetChildren();
if (enumer) {
nsISupports *next;
next = enumer->Next();
if (next) {
nsISupports *child;
if (NS_SUCCEEDED(enumer->CurrentItem(&child))) {
nsIWidget *widget;
if (NS_OK == next->QueryInterface(kIWidgetIID, (void**)&widget)) {
if (NS_OK == child->QueryInterface(kIWidgetIID, (void**)&widget)) {
widget->Resize(0, 0, 200,
((nsSizeEvent*)aEvent)->windowSize->height, PR_TRUE);
NS_RELEASE(widget);

View File

@ -832,7 +832,8 @@ void DumpRects()
// print all children's position
nsIEnumerator *enumerator = window->GetChildren();
nsISupports * widget;
while (widget = enumerator->Next()) {
if (NS_SUCCEEDED(enumerator->CurrentItem(&widget))) {
do {
nsIWidget *child;
if (NS_OK == widget->QueryInterface(kIWidgetIID, (void**)&child)) {
//
@ -842,6 +843,8 @@ void DumpRects()
}
NS_RELEASE(widget);
}
while (enumerator->Next());
}
NS_RELEASE(enumerator);
delete enumerator;