>> You are right, in all cases we know of, the code does the correct checks :-).
>> But I vaguely remember fixing bugs where the code did not properly check for SP_TYPE.
>> It's just that there might be bad code somewhere, and then a NULL exception is that much easier to kill. The performance hit is not an issue I think, and is something that is easy to measure.
> I’ll add that as you suggested, nevermind ;) .
Actually, this doesn’t work.
SPItem *item=SP_ITEM(desktop->currentLayer()->appendChildRepr(this->repr));
> expanded: SPItem *item=((dynamic_cast<const SPItem*>((SPObject*)desktop->currentLayer()->appendChildRepr(this->repr)) != 0) ? (SPItem*)desktop->currentLayer()->appendChildRepr(this->repr) : 0)
This will call appendChildRepr twice and finally fail in an assertion, because the repr got modified.
Seems like finding a working solution isn’t that easy ;) .
Regards,
Markus