Any idea what causes error "Pure virtual funciton being called while application was running (GIsRunning == 1)."

[Edit: I found steps to reproduce 100% of the time, so I guess I’ll troubleshoot this the way I normally would. I’ll come back and let you know if I figure out what causes the ‘pure virtual function being called’ error.]

This happens to me once in a while. I can’t get it to happen on command, but it happens frequently enough to worry me. It only happens when I am closing a specific Scaleform menu, maybe less than 1 time in 20, maybe only after I navigate back and forth to some other menus. I click on the button that closes the menu, and then I get a popup that says “Pure virtual funciton being called while application was running (GIsRunning == 1).” And then the game crashes with a huge error. I copied the error from the log below.

[0074.03] Critical: appError called: Pure virtual function being called
[0074.03] Critical: Windows GetLastError: The operation completed successfully. (0)
[0080.12] Log: === Critical error: ===
Pure virtual function being called

Address = 0xb8744f99 (filename not found) [in C:\WINDOWS\System32\KERNELBASE.dll]
FOutputDeviceWindowsError::Serialize() Address = 0x97a34865 (filename not found) [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
FOutputDevice::Logf__VA() Address = 0x979d9dad (filename not found) [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
`FFrameEndSync::Sync'::`8'::FenceCommand::`vector deleting destructor'() Address = 0x9995f74e (filename not found) [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Address = 0x579e0594 (filename not found) [in C:\WINDOWS\SYSTEM32\MSVCR100.dll]
Scaleform::GFx::AS3::Instances::EventDispatcher::CaptureEventFlow() 0x9a10007e + 15 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\obj\events\as3_obj_events_eventdispatcher.cpp:716] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::Instances::EventDispatcher::DoDispatchEvent() 0x9a106905 + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\obj\events\as3_obj_events_eventdispatcher.cpp:642] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::Instances::EventDispatcher::dispatchEvent() 0x9a106d2c + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\obj\events\as3_obj_events_eventdispatcher.cpp:246] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::ThunkFunc1<Scaleform::GFx::AS3::Instances::EventDispatcher,1,bool,Scaleform::GFx::AS3::Instances::Event * __ptr64>::Func() 0x9a0f622d + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\as3_marshalling.h:1445] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::VM::ExecuteVTableIndUnsafe() 0x9a21a107 + 30 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\as3_vm.cpp:3865] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::VM::exec_callmethod() 0x9a21d862 + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\as3_vm.cpp:2409] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::VM::ExecuteCode() 0x9a2204f4 + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\as3_codeexecute.cpp:3431] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::VM::ExecuteAndRetrieveResult() 0x9a222703 + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\as3_vm.h:1896] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::VM::ExecuteInternalUnsafe() 0x9a223669 + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\as3_vm.cpp:3799] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::Instances::EventDispatcher::DispatchSingleEvent() 0x9a1002a4 + 146 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\obj\events\as3_obj_events_eventdispatcher.cpp:753] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::Instances::EventDispatcher::DoDispatchEvent() 0x9a106965 + 21 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\obj\events\as3_obj_events_eventdispatcher.cpp:647] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::Instances::EventDispatcher::Dispatch() 0x9a10772d + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\obj\events\as3_obj_events_eventdispatcher.cpp:628] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::AvmInteractiveObj::OnFocusChange() 0x9a1de0eb + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\as3_avminteractiveobj.cpp:138] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::AS3::MovieRoot::NotifyOnFocusChange() 0x9a1df360 + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\as3\as3_movieroot.cpp:1063] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::MovieImpl::QueueSetFocusTo() 0x99e38c20 + 43 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\gfx_playerimpl.cpp:4088] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::MovieImpl::ProcessMouse() 0x99e3bd88 + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\gfx_playerimpl.cpp:1978] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::MovieImpl::ProcessInput() 0x99e43090 + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\gfx_playerimpl.cpp:1779] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Scaleform::GFx::MovieImpl::Advance() 0x99e4686f + 0 bytes [File=d:\depot\unrealengine3-sf4-pure\src\gfx\gfx_playerimpl.cpp:1475] [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
FGFxEngine::Tick() Address = 0x98bf0ea2 (filename not found) [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
UGFxInteraction::Tick() Address = 0x98bf1e17 (filename not found) [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
UGameViewportClient::Tick() Address = 0x98323861 (filename not found) [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
UGameEngine::Tick() Address = 0x980727f7 (filename not found) [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
FEngineLoop::Tick() Address = 0x99965f7e (filename not found) [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
GuardedMain() Address = 0x9996fa1f (filename not found) [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
GuardedMainWrapper() Address = 0x9996fa8a (filename not found) [in D:\Perforce\Nathaniel1_UE3_Licensee_Rockwell\UnrealEngine3\Binaries\Win64\RPGTacGame.exe]
Address = 0x43494df1 (filename not found) 

Any idea what this might be about?

Your script try to open a movie that is destroyed, but the engine don’t know it is destroyed and wants to open it! So it try, and crash the game.
That happened to me when for some reason, my script tried to open the HUD movie while the level traveling. Most of the time, it was a success but frequently I’ve got this pure virtual crash.

Yes, i believe a scaleform resource has been garbage collected in your flash application, while US still holds a reference to it, so when attempting to access it, it would cause a memory address error. At least this is what I would expect looking at the error log.

This can also happen the other way round, if you forget to notify flash you are destroying a resource in US and flash continues to hold a reference to it.

Well, I eventually fixed it. It took me an entire day to track it down. You were both right, I think. It probably was, in the end, a problem with the embedded Flash player having deleted something.

I thought there might be a problem with an UnrealScript reference to something that no longer existed. If that were the case, then at least I can say that the game didn’t crash or throw errors immediately after calling a function on a deleted GFxObject. I removed all listeners on everything that I knew would cause the error, navigated the menu using only console commands, did the thing I knew would lead to an error, and then clicked on something that didn’t have a listener on it. The thing I clicked on had not been deleted, removeChild'ed, or touched at all. It wasn’t sending any messages to the game through ExternalInterface or through any delegated functions. It was basically a non-interactive part of the background. But when I clicked on it, it threw the error.

Ultimately, the problem ended up being in the transition out of a previous menu. The transition had a tween on the timeline that made a fade-to-black (increasing alpha on a plain black rectangle that covers the stage), and when the screen is fully black, the timelines for all the other layers end (effectively setting their references to null, or so I thought), and then the tween fades back in from black. Then I call removeChild to remove the menu from the stage and I call a function to tell UnrealScript to set its GFxObject reference to none. It all seemed pretty clean to me. But the next thing I click on after closing that menu (but only after doing a specific thing in that menu…) throws the “pure virtual function” error.

Ultimately, I fixed it by changing the transition. A fade-to-black tween on one layer still happens. But instead of ending the timeline for all the other layers, I set everything’s .visible=false. Their layers on the timeline continue all the way through to the end.

So I guess the moral of the story is “Don’t try to delete anything by ending its layer on the timeline. If it’s on the timeline, make it invisible when you don’t need it anymore.”

You should be able to do null checks to solve that, if it is not null, then do load it or what ever. Else it is null, ignores the call to whatever it is that crashes you. Should stop your crash.

I don’t believe this would work, because it is holding a pointer to a memory address. If you haven’t manually cleared the reference (when you destroy the resource in US), it would be pointing to an address that no longer exists.

Once you get into the habit of keeping your code cleaned up and synced between the two applications, this no longer becomes an issue. So basically, don’t rely on the garbage collector when you’re linking references between US and AS3.

Yeah your right, you would need to null it, to stop the crash.