Apparent bug in ColourDBox
Nick Roberts (518) 4 posts |
I’ve had several emails letting me know that ZeroPain is reporting problems for BookMaker. After looking into this (not made easier by a lack of a working DDT), the problem (at least the first one) is caused by the line: toolbox_create_object(0,ColourDboxName,&colourObject);where ColourDBoxName is set to “ColourDbox” (no quotes), which is the name of a ColourDBox object in the Res file. Having checked the Res file, the object does indeed exist (and I can create it and open it from !ResTest). I then noticed that the “Title” attribute is set to Default, and consequently the title length is faded. In full “grasping at straws” mode, I specified a title, and set the Length field to greater than length required. With these changes, BookMaker works, at least in the basics. This looks to me like a bug in the ColourDBox module – or can anyone suggest a better reason? |
Colin (478) 2433 posts |
ColourDboxName should point to either a string or a template block. If it is a string it should have quotes around it. If it is a pointer to a string could the pointer ever be 0. |
Nick Roberts (518) 4 posts |
The parameter that I passed in was indeed a string. The problem is not that I passed in the wrong parameter – if I had, it wouldn’t have worked at all, and until ZPP happened it’s been working for years. The problem is that the module isn’t handling the default title properly. |
Sprow (202) 1159 posts |
It certainly looks that way when the object is created the decision about the default title seems screwy. You end up with internal→title = NULL then it tries to do a strlen() on it. In the Toolbox manual it says a NULL title should get you the default, and there’s no particular significance attached to the max title length. However it’s being checked anyway and you end up with a “Colour choice” as the title, despite the correct internationalised text being “Colour Selector” that code is never reached unless you manually fiddle the length to be non zero first. Looking what ResEd saves for default, the title MsgReference is 0xFFFFFFFF and length 0, or as appropriate if a non default title is given. |