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++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » TheIDE Format Setup BUG
Re: TheIDE Format Setup BUG [message #30038 is a reply to message #29889] Sat, 04 December 2010 20:41 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
dolik.rce wrote on Sat, 27 November 2010 12:38

Forget most of what I said in my previous post Smile I dug deeper and found out that the reason why XGetImage fails is most probably that it is called on an image with one dimension equal to zero. The other calls are guarded against such thing, but this one for alpha layer was left unprotected.

I believe that if the image is empty (that is zero pixels in any direction, or in code GetSize().IsEmpty()==true), we don't have to bother drawing it at all, right? Or are there some side effects I didn't notice? I'd suggest something like:
ImageDraw::operator Image() const
{
	if(size.IsEmpty()){              // this block is added
		ImageBuffer ib(size);
		return ib;
	}
	GuiLock __;
	XImage *xim = XGetImage(Xdisplay, dw, 0, 0, max(size.cx, 1), max(size.cy, 1), AllPlanes, ZPixmap);
	Visual *v = DefaultVisual(Xdisplay, Xscreenno);
	RasterFormat fmt;

	RGBA   palette[256];
// ...
}

For me it works fine and eliminates the crashes. The roll-out animation of color selector even looks a bit smoother now (but that might be just my imagination Smile ).

Oh, and I almost forgot to mention that the troublesome call to this operator Image() is located in Image WheelRampCtrl::PaintWheel(Size size) in DlgColor.cpp, in the "return iw;" statement (iw is the empty ImageDraw) where implicit conversion to Image happens.

Honza


I guess this is the (almost) same fix I am proposing in previous post - and which is in trunk already (well, since my previous post at least Smile

Is current trunk working ok?

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Debugging - Wrong tooltip on mousehover
Next Topic: Suggestion about Execute command
Goto Forum:
  


Current Time: Tue May 14 00:48:04 CEST 2024

Total time taken to generate the page: 0.02693 seconds