Page 1 of 2

MultiColumnList::setItem problem in release mode

Posted: Sat Mar 05, 2005 20:40
by spannerman
Hey Eddie,

I think have found a problem that I was slightly aware of for a little while...I never managed to track it, and I had forgotten all about it till now. Turns out its tricky to see because it doesnt happen in my debug builds, only in release!

I have some code creating my multicolumnlist:

Code: Select all

MultiColumnList* mcl = (MultiColumnList*)winMgr.createWindow("TaharezLook/MultiColumnList", "templateList");
TabAvailablePanel->addChildWindow(mcl);
mcl->setPosition(Point(0.01f, 0.11f));
mcl->setSize(Size(0.98f, 0.70f));
mcl->setMaximumSize(Size(1.0f, 1.0f));

mcl->addColumn("Script", 0, 0.26f);
mcl->addColumn("Template", 1, 0.29f);
mcl->addColumn("Loaded", 2, 0.12f);

mcl->setSortColumnByID(mcl->getColumnWithHeaderText("Template"));
mcl->setSortDirection(CEGUI::ListHeaderSegment::SortDirection::Ascending);


I have just recently added the last two lines. There arent any items in the list to sort at this point, but I was experimenting.

Anyway, this code looks sound to me and it works fine in Debug, but Release throws the following error:

Code: Select all

Exception: MultiColumnList::setItem - the specified row index is invalid.

Re: MultiColumnList::setItem problem in release mode

Posted: Sat Mar 05, 2005 20:58
by CrazyEddie
Hmmm. Very odd.

I'll have a play around tomorrow probably, in the mean time is there any chance of a callstack / backtrace so we have a better idea as to how we got to the problem area (and possibly saving me having to actually compile any code ;) ).

Cheers,

CE.

Re: MultiColumnList::setItem problem in release mode

Posted: Sat Mar 05, 2005 21:35
by spannerman
Yeah, this is a strange one, so Ive double checked to make sure Im not posting about something that isnt really happening (wouldnt be the first time :oops: ) but it is definately happening, with full rebuilds of both debug and release.

About the callstack / backtrace, ok I'll see what I can come up with. Im not sure how to do that right now, but I'll study up. Actually I didnt think you could unless running in Debug (and since it doesnt happen in debug it may be tricky).

Re: MultiColumnList::setItem problem in release mode

Posted: Sat Mar 05, 2005 23:12
by CrazyEddie
spannerman wrote:
Actually I didnt think you could unless running in Debug (and since it doesnt happen in debug it may be tricky).

Yeah, this could be a problem, though you could tweak the release config to include symbols and try that. If you can't get it don't worry too much, I'll just give it a whirl tomorrow and try to recreate the issue.

CE.

Re: MultiColumnList::setItem problem in release mode

Posted: Sun Mar 06, 2005 13:48
by spannerman
I must admit Im pretty green to all this, especially debugging in VC. I cant seem to find much help via google about doing this, but if you want to give me some pointers (pages on the net somewhere etc) or know how to quickly add these symbols to my release config, by all means I'll give it a go.

Sorry I've not been much help so far here, especially if this turns out to be something only happening to me :roll:
I mean, realistically the chances are its something my end, right? I cant imagine why things would act so differently between Debug and Release versions of the same code.

Re: MultiColumnList::setItem problem in release mode

Posted: Sun Mar 06, 2005 16:07
by CrazyEddie
Sorry I've not been much help so far here, especially if this turns out to be something only happening to me :roll:
I mean, realistically the chances are its something my end, right? I cant imagine why things would act so differently between Debug and Release versions of the same code.

Don't worry about it ;) I'll compile your code snippet shortly and see what happens, though in all honesty, I do think a non-library based problem exists (demo 7 uses similar code to what you posted and there's no problem there).

To enable symbols in release builds, get the project properties page up, select the "C++ -> General" option sheet, and then choose something appropriate for the "Debug Information Format" setting (for the release config, obviously).

The whole debugging thing is all about practice really, the more you do it the better you get. I was going to confess about how I got a lot of practice inside debugging tools, though that's a story for another time, perhaps ;)

HTH

CE.

Re: MultiColumnList::setItem problem in release mode

Posted: Sun Mar 06, 2005 22:24
by spannerman
Cool :)

Ok, thanks for tips, Im making some progress, managed to get some sort of debugging going on in my release build now - Just need to get the stack trace thingy in there now ;) Ive been reading about something called a minidump too...

So whats this story with the debugging tools thing then? No time like the present you know.

Re: MultiColumnList::setItem problem in release mode

Posted: Mon Mar 07, 2005 09:46
by CrazyEddie
spannerman wrote:
So whats this story with the debugging tools thing then? No time like the present you know.

It mainly has to do with the amount of time I used to spend in debuggers and related tools while performing certain "questionable" modifications to apps. I think it's possible that spending days at a time, staring at raw disassembly, stackframes and call-stacks with no symbols, kind of instills something in you which 'normal' debugging probably never can; so at least I came out of my shady past with something good :shock: Maybe I have said too much?

CE.

Re: MultiColumnList::setItem problem in release mode

Posted: Mon Mar 07, 2005 10:32
by spannerman
Yowzers, Eddie :shock:

I must say I'm very intrigued, but by the sounds of it I doubt you would be able to divulge more. So thats where you get your dev skills eh?

[Spanner Serman]
I think whatever 'improper' business you used to be involved with has now been fully redeemed by your embrace of opensource software, and whatever you may have 'took' has been repaid to the public. Let not your dishonest past bear weight on your hopes of the future.

I call upon the holy hammer to squash thine sins :hammer:
[/Spanner Serman]

Re: MultiColumnList::setItem problem in release mode

Posted: Mon Mar 07, 2005 18:52
by CrazyEddie
spannerman wrote:
So thats where you get your dev skills eh?

Well, not all of them. Most have come from much more productive pursuits :)

[Spanner Serman]
I think whatever 'improper' business you used to be involved with has now been fully redeemed by your embrace of opensource software, and whatever you may have 'took' has been repaid to the public. Let not your dishonest past bear weight on your hopes of the future.

I call upon the holy hammer to squash thine sins :hammer:
[/Spanner Serman]

I feel cleansed already. What we're missing is an emoticon with a halo :-D

Is there any progress? I have not had a chance to do try anything yet, as I have been trying to sort out things for a helper framework to support some sample apps.

CE.

Re: MultiColumnList::setItem problem in release mode

Posted: Mon Mar 07, 2005 19:47
by spannerman
Nothing definate to report back yet Im afraid, but dont worry too much about this issue because this has got to be something unique with my setup. Im just waiting to see if mac can reproduce this too, and Im continuing with my release debug sessions to try get that extra info.

I'll get back to you here as soon as I have something more solid to report :)

Re: MultiColumnList::setItem problem in release mode

Posted: Tue Mar 08, 2005 09:22
by CrazyEddie
Ok. Cool 8)

Re: MultiColumnList::setItem problem in release mode

Posted: Tue Mar 08, 2005 12:08
by spannerman
Ok, it seems like this is a problem that is only happening to me :(

mac has confirmed that he is not affected by the strange 'release only' crashes that I am getting...yet he is using the same projects and code! How odd :roll:
I even did a quick complete start by creating a new project and adding the existing code in, and rebuilding everything etc. but it still happens.

I will continue trying to get the extra debug info out of this, but you shouldnt worry about this Eddie, sorry for the false alarm.

Re: MultiColumnList::setItem problem in release mode

Posted: Tue Mar 08, 2005 13:20
by CrazyEddie
Hey no problemo. Sounds like it's possibly some kind of compiled binary mis-match or similar. So, you need plent of these :pint: , and one of these :hammer: .

I know this kind of thing is very annoying, so I hope you find the problem soon.

CE.

Re: MultiColumnList::setItem problem in release mode

Posted: Thu Mar 10, 2005 21:29
by mac
Hi CE,

unfortunately I can replicate the problem. It only happens when optimisation is turned on for CEGUIBase! For some stupid reason I had turned off optimisation for the release version, so I could not reproduce spannermans finding :oops:

In release mode the function MultiColumnList::addRow(item, col_id) returns a very high number. More specific: the line

Code: Select all

pos = (uint)std::distance(d_grid.begin(), d_grid.insert(std::upper_bound(d_grid.begin(), d_grid.end(), row), row));
returns this value. It is not a problem of casting to uint (I changed that already to test...).

I put a #pragma around the function to turn off the optimisation - so everything is fine for now. When I find time I will try to prepare a minimal demo that reproduces the problem.

Many thanks for the help so far!
Cheers, mac

:hammer: (just couldn't resist... maybe it's a sort of peer pressure)