diff --git a/khtml/rendering/render_replaced.cpp b/khtml/rendering/render_replaced.cpp
index 80632cc81..01379930a 100644
--- a/khtml/rendering/render_replaced.cpp
+++ b/khtml/rendering/render_replaced.cpp
@@ -529,7 +529,8 @@ static void copyWidget(const TQRect& r, TQPainter *p, TQWidget *widget, int tx,
if (!widget->childrenListObject().isEmpty()) {
// build region
- TQObjectListIterator it = widget->childrenListObject();
+ TQObjectList childWidgets = widget->childrenListObject();
+ TQObjectListIterator it(childWidgets);
for (; it.current(); ++it) {
TQWidget* const w = ::tqqt_cast(it.current());
if ( w && !w->isTopLevel() && !w->isHidden()) {