View Full Version : How to mess QMdiArea indexes?

21st April 2008, 18:09

Since my problem is too hard to explicate, I'm looking for ideas.
I'm going to request a brain-storming, I need all sort of suggestions, hints, tips, and more, then I'll try appropriated solutions.

The topic is: "How could you mess up QMdiArea indexes?"
Imagine that you have to mess up the indexes of the subwindows of a QMdiArea, in order to obtain a:
ASSERT failure in QList<T>::at: "index out of range", file ../../include/QtCore/../../src/corelib/tools/qlist.h, line 391

So, since indexes are anyway managed internally by QMdi system, how could be possible to twist this system, having an index that referse to -1 or to a number larger than the effective number of opened widgets?
Delete, removeSubWindows,WA_DeleteOnClose... everything, even the most useless idea might be usefull!
Ok, let's go.

21st April 2008, 21:22
Why don't you get a backtrace and see exactly where the call comes from?

21st April 2008, 22:46
Why don't you get a backtrace and see exactly where the call comes from?
Because actually I don't know how to get it...
Anyway debugging I found the calling function, but the mistery continues.

Update: I discovered another input, so the question now is become:
"if I close the MdiSubWindow I get the assertion failed. If before to close the same MdiSubWindow, I make it lose the focus (because I switched to another application, then I came back, for example), and then I close it, no assertion failed. The healing focus. Now the question is: why this weirdness? What sort of magic acts the loss of the focus??"

Thank you so far, please continue with your ideas!