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] Add() crashes system
[BUG - FIXED] Add() crashes system [message #11109] Mon, 20 August 2007 13:17 Go to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 916
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Short description: second call to TabCtrl::Add() causes system crash on Windows XP.

Steps:
1) Adding TabCtrl control to TopWindow with layout.
2) Adding some event (i.e. button push) to create new tab in TabCtrl control.
3) Event calls TabCtrl::Add()
4) Compiling, executing application
5) On SECOND button push system crashes.

Sample code:
void MainWindow::OnNewTab()
{
	tabs.Add();
	tabs.Refresh();
}


It is something obviously with Add(), because the same code with a call to Add(const char *) causes NO crash:
void MainWindow::OnNewTab()
{
	tabs.Add("12345");
	tabs.Refresh();
}

[Updated on: Mon, 20 August 2007 21:19]

Report message to a moderator

Re: [BUG] Add() crashes system [message #11114 is a reply to message #11109] Mon, 20 August 2007 20:26 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11993
Registered: November 2005
Ultimate Member
Wow, do I understand well that it causes XP to crash for you as well?

That is really something Smile

Going to investigate.

Mirek
Re: [BUG] Add() crashes system [message #11115 is a reply to message #11114] Mon, 20 August 2007 20:39 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11993
Registered: November 2005
Ultimate Member
luzr wrote on Mon, 20 August 2007 14:26

Wow, do I understand well that it causes XP to crash for you as well?

That is really something Smile

Going to investigate.

Mirek


Well, the fix is trivial:

TabCtrl::Item& TabCtrl::Add()
{
	Item& t = tab.Add();
	t.owner = this;
	if(sel < 0)
		Set(0);
	Layout(); //<<<<<<<<<<<< this was missing...
	return t;
}


and the reason why it has crashed XP is that there were some pretty bad numbers going into GDI, as the tab had wrong layout.. (obviously, M$ should take better care there, it looks like another vulnerability).

I have also added Refresh at the end of Layout (so that you do not have to do it manually, that was a bug too).

Mirek
Re: [BUG] Add() crashes system [message #11120 is a reply to message #11109] Mon, 20 August 2007 21:18 Go to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 916
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Well, that`s great!
Thanks, Mirek!

P.S. Just found brand new fast resetting technique! Smile
Previous Topic: Deleting Tabs
Next Topic: Why this doesn't work ?
Goto Forum:
  


Current Time: Fri Aug 23 06:48:49 CEST 2019

Total time taken to generate the page: 0.00815 seconds