[sldev] Why won't isAvatar() work?
Jason Giglio
gigstaggart at gmail.com
Wed Oct 3 19:51:54 PDT 2007
Michael Miller wrote:
> 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?
You are checking to see if it's NULL, so it's not... Looks like it's a
dangling pointer. You somehow what objectp points to without nulling
the pointer.
Hint: Use a smart pointer (LLPointer) class and this won't happen
nearly as much.
-Jason
More information about the SLDev
mailing list