Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TabCtrl » [BUG - FIXED] TabDlg crashes the application
[BUG - FIXED] TabDlg crashes the application [message #8574] Mon, 19 March 2007 19:00 Go to next message
victorb is currently offline  victorb
Messages: 78
Registered: December 2005
Location: Nice, France
Member
There is a bug in TabDlg making applications crash.

My config is as follow:
- 2007.1 rc3,
- WinXP SP2,
- MinGW.

There is no issue as long as build in DEBUG mode but as soon as you switch to OPTIMAL mode the appli crashes when TabDlg is opened.

I have first noticed this bug with my own application but you can reproduce it with the reference code "TabDlg".

I am going to start investigate this and post if I can find a solution.

Victor

[Updated on: Wed, 21 March 2007 11:02]

Report message to a moderator

Re: [BUG] TabDlg crashes the application [message #8575 is a reply to message #8574] Mon, 19 March 2007 20:17 Go to previous messageGo to next message
victorb is currently offline  victorb
Messages: 78
Registered: December 2005
Location: Nice, France
Member
It seems to be something wrong with ChPaint() in void TabCtrl::PaintTabs(Draw& w)...

Re: [BUG] TabDlg crashes the application [message #8576 is a reply to message #8575] Mon, 19 March 2007 20:27 Go to previous messageGo to next message
victorb is currently offline  victorb
Messages: 78
Registered: December 2005
Location: Nice, France
Member
I trace it down to

Value sChOp(Draw& w, const Rect& r, const Value& v, int op)
{
Value q;
for(int i = sChps().GetCount() - 1; i >= 0; i--) {
q = (*sChps()[i])(w, r, v, op);
if(!IsNull(q))
break;
}
return q;
}

No more time for today... We'll see tomorrow!
Re: [BUG] TabDlg crashes the application [message #8578 is a reply to message #8576] Mon, 19 March 2007 23:50 Go to previous messageGo to next message
victorb is currently offline  victorb
Messages: 78
Registered: December 2005
Location: Nice, France
Member
I finally found the issue in TabCtrl.cpp around l. 180

			ChPaint(w, r,
					(tab.GetCount() == 1 ? style->both : i == 0 ? style->first :
					 i == tab.GetCount() - 1 ? style->last : style->normal)
					[(!IsEnabled() || !t.enabled ? CTRL_DISABLED :
					 	phase?CTRL_PRESSED:
					 		i == hot?CTRL_HOT:CTRL_NORMAL)]
				);


I don't know why but the compiler seems to dislike this writting... it could be fixed by rewritting the code as

			int idx;
				ChPaint(w, r,
					(tab.GetCount() == 1 ? style->both : i == 0 ? style->first :
					 i == tab.GetCount() - 1 ? style->last : style->normal)
					[idx = (!IsEnabled() || !t.enabled ? CTRL_DISABLED :
					 	phase?CTRL_PRESSED:
					 		i == hot?CTRL_HOT:CTRL_NORMAL)]


Is it a compiler issue ? I am using 3.4.2 (delivered with Upp) could someone give it a try with an other version ?

Thanks,
Victor
Re: [BUG] TabDlg crashes the application [message #8580 is a reply to message #8578] Tue, 20 March 2007 00:25 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks. I will investigate tomorrow...

Mirek
Re: [BUG] TabDlg crashes the application [message #8588 is a reply to message #8580] Tue, 20 March 2007 13:57 Go to previous messageGo to next message
victorb is currently offline  victorb
Messages: 78
Registered: December 2005
Location: Nice, France
Member
I have updated to GCC4.1.2 today and the issue has disappeared.

It seems to confirm a compiler bug.

One *interesting* thing: the executable size has increased from 1.7M to 2.6M!

[Updated on: Tue, 20 March 2007 13:58]

Report message to a moderator

Re: [BUG] TabDlg crashes the application [message #8593 is a reply to message #8588] Tue, 20 March 2007 15:05 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Are you (or was) using ld or uld?

Check the ld.exe in your mingw/bin. If it is >300KB, it is ld (mingw supplied linker), if it is smaller it is uld. uld is shipped with U++-mingw release. Using uld can have impact on executable size.

Mirek

[Updated on: Tue, 20 March 2007 15:12]

Report message to a moderator

Re: [BUG] TabDlg crashes the application [message #8594 is a reply to message #8593] Tue, 20 March 2007 15:12 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, I have patched the code anyway.... Smile

Mirek
Re: [BUG] TabDlg crashes the application [message #8596 is a reply to message #8594] Tue, 20 March 2007 16:25 Go to previous message
victorb is currently offline  victorb
Messages: 78
Registered: December 2005
Location: Nice, France
Member
I was not aware about uld. Thanks for the tip.

My app has now decreased back to 1.8MB (slightly bigger than with U++ delivered MinGW)
Previous Topic: TabCtrl and layouts
Next Topic: How to resize TabCtrl?
Goto Forum:
  


Current Time: Fri Mar 29 00:11:39 CET 2024

Total time taken to generate the page: 0.01485 seconds