diff --git a/widget/tests/scribble/Scribble.cpp b/widget/tests/scribble/Scribble.cpp index 9280b6d73ced..bdca229a9879 100644 --- a/widget/tests/scribble/Scribble.cpp +++ b/widget/tests/scribble/Scribble.cpp @@ -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); diff --git a/widget/tests/widget/nsWidgetTest.cpp b/widget/tests/widget/nsWidgetTest.cpp index fb69a10e4116..7075dfd49d48 100644 --- a/widget/tests/widget/nsWidgetTest.cpp +++ b/widget/tests/widget/nsWidgetTest.cpp @@ -832,15 +832,18 @@ void DumpRects() // print all children's position nsIEnumerator *enumerator = window->GetChildren(); nsISupports * widget; - while (widget = enumerator->Next()) { - nsIWidget *child; - if (NS_OK == widget->QueryInterface(kIWidgetIID, (void**)&child)) { - // - child->GetBounds(rect); - printf("Bounds(%d, %d, %d, %d)\n", rect.x, rect.y, rect.width, rect.height); - NS_RELEASE(child); - } - NS_RELEASE(widget); + if (NS_SUCCEEDED(enumerator->CurrentItem(&widget))) { + do { + nsIWidget *child; + if (NS_OK == widget->QueryInterface(kIWidgetIID, (void**)&child)) { + // + child->GetBounds(rect); + printf("Bounds(%d, %d, %d, %d)\n", rect.x, rect.y, rect.width, rect.height); + NS_RELEASE(child); + } + NS_RELEASE(widget); + } + while (enumerator->Next()); } NS_RELEASE(enumerator);