Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » Rare bug on CtrlCore/ImageWin32.cpp 
	
		
		
			| Rare bug on CtrlCore/ImageWin32.cpp [message #46058] | 
			Fri, 26 February 2016 04:39   | 
		 
		
			
				
				
				
					
						  
						rxantos
						 Messages: 73 Registered: October 2011 
						
					 | 
					Member  | 
					 | 
		 
		 
	 | 
 
	
		On function 
void ImageSysData::Paint(SystemDraw& w, int x, int y, const Rect& src, Color c);
  
 
Search for  
if(!himg) {
  LTIMING("Image Alpha create");
  BitmapInfo32__ bi(sz.cx, sz.cy);
  himg = CreateDIBSection(ScreenHDC(), bi, DIB_RGB_COLORS, (void **)§ion, NULL, 0);
  Copy(section, ~img, img.GetLength());
}
 
 
Sometimes CreateDIBSection fails. Is rare, but it does happen returning 0 in the process, which causes the Copy function to crash the application. 
Propose to change with. 
if(!himg) {
  LTIMING("Image Alpha create");
  BitmapInfo32__ bi(sz.cx, sz.cy);
  himg = CreateDIBSection(ScreenHDC(), bi, DIB_RGB_COLORS, (void **)§ion, NULL, 0);
  ASSERT(himg); // Assert on debug
  if(!himg) {
   return; // Return on release.
  }
  Copy(section, ~img, img.GetLength());
}
 
 
 
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 09:45:52 CET 2025 
 Total time taken to generate the page: 0.08603 seconds 
 |