Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

Property accessor bug?

Started by hoboaki Mar 10, 2010 at 6:39 AM 5 replies 1.3k views
Original Post
hoboaki
hoboaki
Hi! When I used property accessor in script, my application stopped. Is this bug? //----------------------------------------------------------- // AngelScript script code class Vector3 { float x; float y; float z; }; class Hoge { const Vector3 get_pos()const { return mPos; } const Vector3 foo()const { return pos; } Vector3 mPos; }; void main() { Hoge h; const Vector3 vec = h.foo(); } //----------------------------------------------------------- Version: AngelScript r564(Debug Build Version) Compiler: MSVC8 Calltrace: GameProject.exe!asCArray::operator[](unsigned int index=0) Line 147 + 0x6 Bytes C++ GameProject.exe!asCContext::CallInterfaceMethod(asCScriptFunction * func=0x0a8e1058) Line 1254 + 0x15 Bytes C++ GameProject.exe!asCContext::ExecuteNext() Line 2790 C++ GameProject.exe!asCContext::Execute() Line 1004 + 0x8 Bytes C++ GameProject.exe!base::ags::ContextHandle::execute() Line 104 + 0x23 Bytes C++ GameProject.exe!app::scene::SceneASTest::onSceneStart() Line 67 C++ GameProject.exe!app::Application::beginSceneProcess() Line 191 + 0x23 Bytes C++ GameProject.exe!app::Application::execute() Line 99 + 0xc Bytes C++ GameProject.exe!`anonymous namespace'::t_executeApplication() Line 50 + 0xb Bytes C++ GameProject.exe!app::EntryPoint::run() Line 73 C++ GameProject.exe!wmain(int __formal=1, int __formal=1) Line 16 C++ GameProject.exe!__tmainCRTStartup() Line 594 + 0x19 Bytes C GameProject.exe!wmainCRTStartup() Line 414 C
WitchLord
WitchLord
This does indeed look like a bug. I'll investigate it.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
WitchLord
WitchLord
I wasn't able to reproduce this.

Would you mind giving revision 566 a try? The problem may have been fixed already.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
hoboaki
hoboaki
Thank you for your reply.
I tried r566 , but my application stopped.

I created another sample code.

-----------------------------------------------------------class Vector3{    float x;    float y;    float z;}; class Hoge{    const Vector3 get_pos() { return mPos; }    const Vector3 foo() { return pos;  }    const Vector3 zoo() { return get_pos(); }    Vector3 mPos;};  void main(){    Hoge h;    Vector3 vec;    vec = h.zoo(); // ok    vec = h.foo(); // runtime exception}-----------------------------------------------------------


I found difference of foo and zoo in bytecode.


__Hoge_foo.txt
Temps: 1     0   0 *    PUSH     1    1   1 *    PshV4    v0    2   2 *    CALLSYS  17           (void _builtin_object_::_beh_4_())- 11,27 -    4   1 *    SUSPEND    5   1 *    PSF      v0    6   2 *    CALLINTF 86           (const Vector3 Hoge::get_pos())    8   1 *    STOREOBJ v1    9   1 *    LOADOBJ  v1   10   1 * 0:   10   1 *    FREE     v0, 11276368   12   0 *    RET      1


__Hoge_zoo.txt
Temps: 1     0   0 *    PUSH     1    1   1 *    PshV4    v0    2   2 *    CALLSYS  17           (void _builtin_object_::_beh_4_())- 12,27 -    4   1 *    SUSPEND    5   1 *    PshV4    v0    6   2 *    CALLINTF 86           (const Vector3 Hoge::get_pos())    8   1 *    STOREOBJ v1    9   1 *    LOADOBJ  v1   10   1 * 0:   10   1 *    FREE     v0, 11276368   12   0 *    RET      1


Is this correct?
WitchLord
WitchLord
No, the bytecode should be the same for both. With this it should be easy to find the bug, thanks.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
WitchLord
WitchLord
For some reason this doesn't crash for me, but thanks to you I identified and fixed the problem anyway.

You'll find the fix in the SVN rev 567.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
hoboaki
hoboaki
I confirmed that this bug was fixed.
Thank you!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.