BEUG iterator


08-12-2007 15:45:42

I don't know why but it's not the first time that I have this bug.

so It's apear when I move mouse.

in Widget* Widget::getTargetWidget(const Point& pixelPosition)

for( it = mChildWidgets.begin(); it != mChildWidgets.end(); ++it )
if( (*it)->getQuadLayer() == Quad::LAYER_CHILD )

==> Widget* temp = (*it)->getTargetWidget(pixelPosition); <==
if( (temp != NULL) && (temp->getOffset() > widgetOffset) )
widgetOffset = temp->getOffset();
w = temp;

I find that is appear after delete object like that.

//tree is a list;


08-12-2007 20:47:59

Can you post the call stack at time of crash? Stepping into getTargetWidget to see where it crashes would also be good. I would guess that a child was destroyed but not removed from the child list. (dangling pointer) I can't be sure without more information..


08-12-2007 22:42:42

call stack is not very expresive

> QuickGUI_d.dll!QuickGUI::Widget::getTargetWidget(const QuickGUI::Point & pixelPosition={312, 512}) Line 707 + 0x24 bytes C++
QuickGUI_d.dll!QuickGUI::Sheet::getTargetWidget(const QuickGUI::Point & pixelPosition={...}) Line 108 + 0x29 bytes C++
QuickGUI_d.dll!QuickGUI::GUIManager::injectMouseMove(const int & xPixelOffset=11, const int & yPixelOffset=-18) Line 617 + 0x19 bytes C++
GML_Debug.exe!InputManager::mouseMoved(const OIS::MouseEvent & arg={...}) Line 207 + 0x22 bytes C++
[Frames below may be incorrect and/or missing, no symbols loaded for OIS_d.dll]


08-12-2007 22:47:46

Can you step into this? Or in the very least, when it crashes, what is the value of this? Is it 0x0000?


08-12-2007 22:51:49

I can't because I use it as a library but (*it) is unreadable but "it" is good pointer

//// after ////
now I compile with your code.
and this = my tree object it's not null
but it from mChildWidgets is conrupted,

removeAndDestroy is not very good ???


09-12-2007 00:31:42

that sure that the widget that I have delete previously is always in the vector contenair ...


09-12-2007 07:50:24

Destruction of widgets are not destroyed immediately most the time. Widgets are Queued for deletion, the actual destruction occurs after the GUIManager renders the GUI. So in code, if you perform operations on the list right after you destroy the widget, it will still be there. It will be gone next frame though.

Just to be more clear on the issue, are you saying
1. there is a pointer to widget that doesn't exist because it's been deleted,
2. the widget is in the list but I have already made a call to removeAndDestroy

I don't currently have the time to investigate this. If you can reproduce this in the demo it will speed up finding out the cause of this.


09-12-2007 14:02:59

the first one