WretchedMallard
Topic Author
Posts: 2
Joined: 18 Jun 2020, 07:30

Crash from NsUnregisterComponent before NsRegisterComponent

08 Jul 2020, 02:08

Hi,

We have found that if our application requests an exit before it has completely finished its initialization steps it can result in calls to NsUnregisterComponent being made before the corresponding NsRegisterComponent has been called which results in the application crashing.

While understandable that it is not valid to attempt to unregister a component that is not yet registered I am wondering if anyone can shed some light on what these functions are doing internally to result in a crash state?

Tags:
 
User avatar
jsantos
Site Admin
Posts: 2865
Joined: 20 Jan 2012, 17:18
Contact:

Re: Crash from NsUnregisterComponent before NsRegisterComponent

08 Jul 2020, 11:41

Who is calling NsUnregisterComponent? Could you please paste a callstack? I assume this is 2.2, right?
 
WretchedMallard
Topic Author
Posts: 2
Joined: 18 Jun 2020, 07:30

Re: Crash from NsUnregisterComponent before NsRegisterComponent

09 Jul 2020, 01:42

Yes this is version 2.2.

I was not able to yet produce a call stack, but in response to who is calling NsUnregisterComponent our application is calling this function directly to unregister some of our custom components. When running attached to steam the user can call 'stop' from the steam interface which initiates shutdown before our initialization has fully completed.

for example
#define NOESIS_GAME_COMPONENTS()\
	COMPONENT(myComponent)\

//called as part of our initialization step, behind a loading screen
void Init()
{
    #define COMPONENT(component) NsRegisterComponent<component>();
		NOESIS_GAME_COMPONENTS()
    #undef COMPONENT
}

//called as part of our shutdown stage
//in this case steam requested shutdown during initial loading screen, 
//causing this call to happen before init()
void Deinit()
{
    #define COMPONENT(component) NsUnregisterComponent<component>();
		NOESIS_GAME_COMPONENTS()
    #undef COMPONENT
}
However I will also not that I am no longer certain that this is the cause of our issue. In attempting to debug with a minimal example I was not able to produce this exact behavior so it is possible that the true error is from elsewhere in our application

Who is online

Users browsing this forum: Google [Bot] and 2 guests