On Apr 28, 2006, at 11:14 AM, bulia byak wrote:

On 4/28/06, Jon A. Cruz <jon@...18...> wrote:

Before I did some other changes that would require adding a new verb,

I setup a unit test on verbs explicitly. In doing so, I discovered

that Verb::getbyid() fails if the id has any dots in it.


Dunno about verbs, but I fixed this exact bug in SVG id= attributes a year ago:


http://svn.sourceforge.net/viewcvs.cgi/inkscape/inkscape/trunk/src/uri-references.cpp?r1=7023&r2=7916&sortby=date


Probably the verb id code was copy/pasted from there before the fix.



That wasn't the problem in this case.

What it turns out to be is a problem with the null checking on the std::map used to store the ids. They end up with entries with null (e.g. 0) pointers for id's to be in there twice (beginning and end). "org.inkscape.dialogs.extensioneditor" didn't fail because of its dots, but because it was the last item in the table before the null.

I can fix the comparison function, but that leaves the main problem with two verbs being added with null IDs.


Here are the guilty parties:

    /* Header */
    new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL),
...
    /* Footer */
    new Verb(SP_VERB_LAST, NULL, NULL, NULL, NULL)


My current take on things is that once the comparator is fixed, SP_VERB_LAST will stomp over SP_VERB_INVALID. Is that fine, or should we tweak some magic "last" verb ID so that SP_VERB_INVALID will stay in there?