Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualBlackMoons

Posted 17 September 2013 - 11:09 PM

Oh, Here a call stack on the crash:

     Client.exe!operator delete(void * pUserData)  Line 52 + 0x51 bytes    C++
     Client.exe!ObjectRef::`scalar deleting destructor'()  + 0x3c bytes    C++
     Client.exe!ScriptRef::Release()  Line 127 + 0x34 bytes    C++
     Client.exe!asCScriptEngine::CallObjectMethod(void * obj, asSSystemFunctionInterface * i, asCScriptFunction * s)  Line 3568 + 0x8 bytes    C++
     Client.exe!asCScriptEngine::CallObjectMethod(void * obj, int func)  Line 3522    C++
     Client.exe!asCContext::ExecuteNext()  Line 2522    C++
     Client.exe!asCContext::Execute()  Line 1144 + 0x8 bytes    C++

It seems to be calling release on mLight.mOwner but why would it do that?

<edit> Did some more testing. Increasing mOwner's refcount in mLight's constructor didn't help anything. So I have no idea what ObjectRef it is releasing or why.

<edit> Updated to 2.27.1, Still crashes.

Adding AddRef() to ObjectRef's constructor solves the crash, but most likely results in memory leaks.

Incrementing ref's ref count or Light.mOwner's ref count did not fix the crash.

<edit>

Ok, I think I figured it out..

the copy constructor was defined like "ObjectRef@ opAssign(const ObjectRef &in other)" meaning it returned a handle that would then be released since my script does not use it right? And my copy constructor if defined like that should increment the handle it returns?

 

Changing it to "ObjectRef& opAssign(const ObjectRef &in other)" seems to have fixed it. But I am wondering is this the correct fix? Or does my copy constructor need to increment the handle it returns instead? I would rather not make duplicate copy constructors for C++ and Angelscript.


#3BlackMoons

Posted 17 September 2013 - 11:03 PM

Oh, Here a call stack on the crash:

     Client.exe!operator delete(void * pUserData)  Line 52 + 0x51 bytes    C++
     Client.exe!ObjectRef::`scalar deleting destructor'()  + 0x3c bytes    C++
     Client.exe!ScriptRef::Release()  Line 127 + 0x34 bytes    C++
     Client.exe!asCScriptEngine::CallObjectMethod(void * obj, asSSystemFunctionInterface * i, asCScriptFunction * s)  Line 3568 + 0x8 bytes    C++
     Client.exe!asCScriptEngine::CallObjectMethod(void * obj, int func)  Line 3522    C++
     Client.exe!asCContext::ExecuteNext()  Line 2522    C++
     Client.exe!asCContext::Execute()  Line 1144 + 0x8 bytes    C++

It seems to be calling release on mLight.mOwner but why would it do that?

<edit> Did some more testing. Increasing mOwner's refcount in mLight's constructor didn't help anything. So I have no idea what ObjectRef it is releasing or why.

<edit> Updated to 2.27.1, Still crashes.

Adding AddRef() to ObjectRef's constructor solves the crash, but most likely results in memory leaks.

Incrementing ref's ref count or Light.mOwner's ref count did not fix the crash.

 

Is angelscript making a copy of the object or something and releasing it?


#2BlackMoons

Posted 17 September 2013 - 10:21 PM

Oh, Here a call stack on the crash:

     Client.exe!operator delete(void * pUserData)  Line 52 + 0x51 bytes    C++
     Client.exe!ObjectRef::`scalar deleting destructor'()  + 0x3c bytes    C++
     Client.exe!ScriptRef::Release()  Line 127 + 0x34 bytes    C++
     Client.exe!asCScriptEngine::CallObjectMethod(void * obj, asSSystemFunctionInterface * i, asCScriptFunction * s)  Line 3568 + 0x8 bytes    C++
     Client.exe!asCScriptEngine::CallObjectMethod(void * obj, int func)  Line 3522    C++
     Client.exe!asCContext::ExecuteNext()  Line 2522    C++
     Client.exe!asCContext::Execute()  Line 1144 + 0x8 bytes    C++

It seems to be calling release on mLight.mOwner but why would it do that?

<edit> Did some more testing. Increasing mOwner's refcount in mLight's constructor didn't help anything. So I have no idea what ObjectRef it is releasing or why.


#1BlackMoons

Posted 17 September 2013 - 07:47 PM

Oh, Here a call stack on the crash:

     Client.exe!operator delete(void * pUserData)  Line 52 + 0x51 bytes    C++
     Client.exe!ObjectRef::`scalar deleting destructor'()  + 0x3c bytes    C++
     Client.exe!ScriptRef::Release()  Line 127 + 0x34 bytes    C++
     Client.exe!asCScriptEngine::CallObjectMethod(void * obj, asSSystemFunctionInterface * i, asCScriptFunction * s)  Line 3568 + 0x8 bytes    C++
     Client.exe!asCScriptEngine::CallObjectMethod(void * obj, int func)  Line 3522    C++
     Client.exe!asCContext::ExecuteNext()  Line 2522    C++
     Client.exe!asCContext::Execute()  Line 1144 + 0x8 bytes    C++

It seems to be calling release on mLight.mOwner but why would it do that?


PARTNERS