Re: Success 1 Re: XForms: Pixmaps need callbacks ?

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 19 Aug 97 11:40:24 PDT

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> a] Again small pixmap problems ...
> i] One of the colours displayed is incorrect, it is a pink
> and should be a deep blue. I've tried using the
> colourcloseness function with r,g and b set to 0 but no
> help, this colour is still wrong.

If you've a lot of colors (more than 255) it may be that color
quantization or substitution is biting you. I'm not sure how Xpm
deals with colormap overflow but I suspect it's an Xpm problem rather
than an XForms problem.

> ii] I have twelve pixmaps, all very similar, and I load each
> of them from a file into an array of Pixmaps like so :
> static Pixmap * Pixs; // In the header file
> Pixs = new Pixmap[12];
> [...]
> however there is the problem of the one colour being wrong as well
> as the fact that Pixs[0] = Pixs[9], for no apparent reason.
> Is this a correct method for tagging pixmaps for use ?

Print out the Pixmap XID (which is returned by
fl_get_pixmap_pixmap()). Is it being altered somehow?

> Is there a better way ?

Don't think so.

> Hows abouts freeing ?

XFreePixmap().

> form = create_form_form();
> Surprisingly this call fails, I use gdb to find that the error is :
> __libc_malloc (bytes=Cannot access memory at address 0x38.)
> so I edit the create_form_form fdesign generated function, and find
> where the error is, after editing this error out, I still find the
> same malloc error, again at address 0x38, only with the function
> called following the edited out one !

Sounds like memory arena corruption. Are you doing anything else
before calling the create_form_form() function? I've found that
errors such as this are often caused by freeing something more than
once or even by inadvertantly freeing an automatic (stack) variable.

There is a nifty library written by Conor Cahill several years ago
which I use for memory debugging called libdbmalloc. It can be found
at a lot of archive sites. It will nail most common memory corruption
problems quite nicely.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/