[sldev] Why won't isAvatar() work?

Michael Miller 1337mail at gmail.com
Thu Oct 4 05:41:32 PDT 2007


On 10/4/07, Dale Glass <dale at daleglass.net> wrote:
>
> On Wed, Oct 03, 2007 at 09:58:30PM -0400, Michael Miller wrote:
> > At the end of the processObjectUpdate method(in llviewerobjectlist.cpp),
> I
> > check to see if the object is an avatar(after everything in the "stock"
> > source is done). The check looks like this:
> >
> > if(objectp && objectp->isAvatar()){
> > // Do stuff here
> > }
> >
> > The problem lies in the objectp->isAvatar(). I've run this through
> gdb(I'm
> > on Mac OSX "non-10.4 platform"), and the isAvatar() method keeps
> throwing
> > EXEC_BAD_ACCESS exceptions whenever the method is run(when calling
> > isAvatar()). Is this because the objectp variable is "destroyed" or
> > otherwise made inaccessible? How might I remedy this problem?
> >
> > Thanks,
> > Mike
>
> I looked a bit at the code. Do you do it at the end of the function,
> before the last line?


Yes, I do it right before the closing brace of the method(after every last
bit of SL code has been executed).

Note how the function declares:
> LLViewerObject *objectp;
>
> Which isn't initialized.
>
> objectp remains uninitialized until:
> objectp = findObject(fullid);
>
>
> If for some reason the update affects 0 objects (don't know if that may
> ever happen), then objectp may remain uninitialized at the end of the
> function. But you should be adding your code somewhere inside the loop
> anyway, after objectp gets initialized.
>
>
> Change the declaration to:
> LLViewerObject *objectp = NULL;
>
> Crashes on NULL pointers are much easier to debug.


I'll give it a shot. Should(will) this declaration be edited in the main SL
codebase (assuming it works)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.secondlife.com/pipermail/sldev/attachments/20071004/fe635bda/attachment.htm


More information about the SLDev mailing list