🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Auto handles with the ref add-on

Started by
1 comment, last by MrFloat 5 years, 10 months ago

Hello,

I am trying to implement a member function that will return a `ref@`object.

I got the basic function working, but I did not want to deal with reference counting in my code, so I added the auto handle to the object to make it: `ref@+`

However, when I try to register this method I get an error from Angelscript:

(0, 0) : ERR  : Failed in call to function 'RegisterObjectMethod' with 'ScriptObjectHandle' and 'ref@+ get()' (Code: -10)

 

If I remove the auto handle it works fine. If I use a different type (i.e. a type that I have added), it also works fine.

Does anyone know what I'm doing wrong?

Cheers

Jarrett

 

Advertisement

I don't think you're supposed to use @+ for types with asOBJ_ASHANDLE flag
If you look at the ref type registration, it doesn't even have the functionality tegistered to have a counter for itself and asOBJ_ASHANDLE types are a value type, so I guess they don't need a counter.
I assume you don't need track ref counting for the "ref" type itself but for whatever "ref" type holds and looking at the implementation, that is already done when you assign values to the type.

This topic is closed to new replies.

Advertisement