Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » AddColumn(0, ...) crashes 
	
		
		
			| AddColumn(0, ...) crashes [message #41247] | 
			Mon, 18 November 2013 15:57   | 
		 
		
			
				
				
				  | 
					
						  
						koldo
						 Messages: 3453 Registered: August 2008 
						
					 | 
					Senior Veteran  | 
					 | 
		 
		 
	 | 
 
	
		Hello unodgs 
 
Now calling GridCtrl::AddColumn(const char *name, int size, bool idx) with name = 0 will crash the program as it calls ToLower(name).  
 
The reason is that AddColumn() calls ToLower(), that calls FromUtf8(), that calls utf8len(), that calls strlen, and strlen(NULL) raises an exception. 
 
Could you prevent it? 
 
It is added in Redmine here.
		
		
  Best regards 
Iñaki
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: AddColumn(0, ...) crashes [message #41438 is a reply to message #41433] | 
			Tue, 17 December 2013 09:52    | 
		 
		
			
				
				
				  | 
					
						  
						koldo
						 Messages: 3453 Registered: August 2008 
						
					 | 
					Senior Veteran  | 
					 | 
		 
		 
	 | 
 
	
		Hello Klugier 
 
From you screenshot I infer that you have the AddColumn problem. 
 
A simple solution is: 
 
- GridCtrl.cpp, line 1789, to replace 
aliases.Add(ToLower(name), ib.id);  with  
aliases.Add(name ? ToLower(name) : "", ib.id);  
- GridCtrl.cpp, line 1700, to replace  
aliases.Add(ToLower(name), id);  with  
aliases.Add(name ? ToLower(name) : "", id);  
This problem was reported some weeks ago. I would like to see it solved before, mainly because the problem was clearly defined from the beginning.
		
		
  Best regards 
Iñaki
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	
		
		
			| Re: AddColumn(0, ...) crashes [message #41662 is a reply to message #41473] | 
			Wed, 08 January 2014 11:07   | 
		 
		
			
				
				
				  | 
					
						  
						koldo
						 Messages: 3453 Registered: August 2008 
						
					 | 
					Senior Veteran  | 
					 | 
		 
		 
	 | 
 
	
		Fixes to be uploaded today: 
 
GridCtrl.h, line 790
	ItemRect& DoAvg(const char *s = "")            	 { sop = SOP_AVG; sopfrm = s; return *this; }
	ItemRect& DoSum(const char *s = "")              { sop = SOP_SUM; sopfrm = s; return *this; }
	ItemRect& DoMin(const char *s = "")              { sop = SOP_MIN; sopfrm = s; return *this; }
	ItemRect& DoMax(const char *s = "")              { sop = SOP_MAX; sopfrm = s; return *this; }
	ItemRect& DoCount(const char *s = "")          	 { sop = SOP_CNT; sopfrm = s; return *this; }
				
GridCtrl.h, line 1247
	AddColumn("", 0, true) 
				 
				 
GridCtrl.cpp, line 1868
	AddColumn("", size, false);	
	
	
DropGrid.h, line 129 
	GridCtrl::ItemRect& AddIndex(const char *name = ""); 
		
		
  Best regards 
Iñaki
		
 |  
	| 
		
	 | 
 
 
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 08:42:33 CET 2025 
 Total time taken to generate the page: 0.05096 seconds 
 |