What happens to thhe object:
[Mon May 15 04:08:51 2017] INFO: AddRef: 0b06a6c0
[Mon May 15 04:08:51 2017] INFO: AddRef: 0b06a6c0
[Mon May 15 04:08:51 2017] INFO: ReleaseRef: count = 2 0b06a6c0
done calling constructor
[Mon May 15 04:08:51 2017] INFO: Deleting: 0b06a6c0
The last line is call of destructor. (the hex number is pointer value/object address)
The actual deletion happens through AS engine, not through ReleaseRef:
`RefCounted.cpp:45: virtual Urho3D::RefCounted::~RefCounted(): Assertion `refCount_->refs_ == 0' failed.`
Program received signal SIGABRT, Aborted.
0x00007ffff69161c8 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff69161c8 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff691764a in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff690f107 in __assert_fail_base () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff690f1b2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x0000000000b9434f in Urho3D::RefCounted::~RefCounted (this=0x99abf40, __in_chrg=<optimized out>) at /home/slapin/Urho3D/Source/Urho3D/Container/RefCounted.cpp:45
#5 0x00000000008bdeea in BTBaseNode::~BTBaseNode (this=0x99abf40, __in_chrg=<optimized out>) at /home/slapin/dungeon/rework/BehaviorTree.h:22
#6 0x00000000008c24d0 in BTCompositeNode::~BTCompositeNode (this=0x99abf40, __in_chrg=<optimized out>) at /home/slapin/dungeon/rework/BehaviorTree.h:36
#7 0x00000000008c79de in BTSequenceNode::~BTSequenceNode (this=0x99abf40, __in_chrg=<optimized out>) at /home/slapin/dungeon/rework/BehaviorTree.h:47
#8 0x0000000000f073c2 in asCScriptEngine::CallObjectMethod (this=0x239de30, obj=0x99abf40, i=0x23a2580, s=0x23a2600) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptengine.cpp:4038
#9 0x0000000000f0729f in asCScriptEngine::CallObjectMethod (this=0x239de30, obj=0x99abf40, func=2) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_scriptengine.cpp:4010
#10 0x00000000008d7d38 in asCContext::ExecuteNext (this=0x30a25d0) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_context.cpp:4106
#11 0x00000000008d0c77 in asCContext::Execute (this=0x30a25d0) at /home/slapin/Urho3D/Source/ThirdParty/AngelScript/source/as_context.cpp:1297
#12 0x00000000009ad572 in Urho3D::ScriptFile::Execute (this=0x2f04070, function=0x30a2e60, parameters=..., unprepare=true) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/ScriptFile.cpp:324
#13 0x00000000009b038a in Urho3D::ScriptEventInvoker::HandleScriptEvent (this=0x30d6790, eventType=..., eventData=...) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/ScriptFile.cpp:956
#14 0x00000000009b4394 in Urho3D::EventHandlerImpl<Urho3D::ScriptEventInvoker>::Invoke (this=0x9009110, eventData=...) at /home/slapin/Urho3D/Source/Urho3D/AngelScript/../AngelScript/../Core/Object.h:307
#15 0x0000000000b6caeb in Urho3D::Object::OnEvent (this=0x30d6790, sender=0x1cbae10, eventType=..., eventData=...) at /home/slapin/Urho3D/Source/Urho3D/Core/Object.cpp:121
#16 0x0000000000b6d680 in Urho3D::Object::SendEvent (this=0x1cbae10, eventType=..., eventData=...) at /home/slapin/Urho3D/Source/Urho3D/Core/Object.cpp:355
#17 0x0000000000b8bfea in Urho3D::Engine::Update (this=0x1cbae10) at /home/slapin/Urho3D/Source/Urho3D/Engine/Engine.cpp:695
#18 0x0000000000b8b92a in Urho3D::Engine::RunFrame (this=0x1cbae10) at /home/slapin/Urho3D/Source/Urho3D/Engine/Engine.cpp:519
#19 0x0000000000b884ce in Urho3D::Application::Run (this=0x1cbaca0) at /home/slapin/Urho3D/Source/Urho3D/Engine/Application.cpp:86
#20 0x00000000008ca359 in RunApplication () at /home/slapin/dungeon/rework/Urho3DPlayer.cpp:46
#21 0x00000000008ca400 in main (argc=1, argv=0x7fffffffe248) at /home/slapin/dungeon/rework/Urho3DPlayer.cpp:46
So this is kind of reaction on scope loss. Is there some way to prevent AS from deleting objects
and just use reference counting behaviors?