From: Jim I. <ji...@ap...> - 2004-03-19 04:48:54
|
Daniel, On Mar 18, 2004, at 7:16 PM, Daniel A. Steffen wrote: > Jim, > > On Friday, Mar 19, 2004, at 14:04 Australia/Sydney, Jim Ingham wrote: > >> Aren't you already using the obdata field for that purpose? > > not exactly, I'm using obdata to keep track of the pixmap in the case > where the XImage has been copied from screen with GetImage. However I > think the core uses other XImages where image->data is just a manually > allocated GWorld, which has be handled differently (e.g. in > Get/SetPixel, use 8 bit color data instead of 16 bit like for images > copied off screen). I haven't really verified this in depth though. Okay. Would it be possible to set obdata to (void *) -1 or something like that in this case? Then we could still trigger off this to tell how to handle the image. > >> I think we are already going to get into trouble if anybody sets >> this behind our back. So perhaps we can rely on that being non-null >> for cases where we made out of CGraf's of some sort. >> >> The other option is to call IsValidPort on the data from the image, >> and if it is not a valid port, then treat it as a malloc'ed data >> buffer. IsValidPort seems reliable - QD keeps a list of ports, and >> checks against that. So maybe that would be a good way to do it? > > that sounds like the safe way to go about it, indeed anywhere we > currently assume image->data is a port, we should probably be calling > ValidPort and either deal with failures with alternative code or at > least panic instead of crashing... Yes, that sounds like a good idea. > >> It's a bit amusing that QDDebugPrintPortInfo doesn't call >> IsValidPort, but just tries to print the port anyway. I checked the >> code, and indeed that is true... But it is just a debugging >> function. > > maybe still worth a radar... it can be annyoing if you segfault just > because you mistype a port addr in gdb, I've had that happen while I > was fiddling with the Get/PutImage stuff Note that if you put: set unwindonsignal 1 in your .gdbinit file then when a function that you call by hand segfaults it will just unwind back to the point you were calling it. Since you seldom really want to catch a segfault in a called-by-hand function, it isn't a bad idea to keep this setting on. Jim > > Cheers, > > Daniel > > -- > ** Daniel A. Steffen ** "And now for something completely > ** Dept. of Mathematics ** different" Monty Python > ** Macquarie University ** <mailto:st...@ma...> > ** NSW 2109 Australia ** <http://www.maths.mq.edu.au/~steffen/> > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Tcl-mac mailing list > Tc...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-mac > _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Jim Ingham ji...@ap... Developer Tools - gdb |