Jump to content

CIGI crash when changing ownship entity type


photo

Recommended Posts

Hello,

Crash confirmed even with the CIGI demo and HEmu:

  1. create Ownship entity 0 with type 118 (Be200)
  2. remove entity 0
  3. create Ownship entity 0 with type 0 (or anything different than the first declaration) => crash (it doesn't crash if ownship is recreated with the same type)

This use-case is actually used here, when we change from one simulation to another with a different ownship type, without restarting the IG.

 

Link to comment

Hi Amerio,

I fixed the bug.
Please open <SDK Browser>/sdks/<SDK VERSION>/source/plugins/Network/CigiClient/architecture/Entity.cpp file and add one line:

void Cigi::Entity::setState(STATE in_state)
{
	if (state == in_state)
		return;
		
	state = in_state; // ADD THIS LINE!
	
	if (!node)
		return;
}

It will fixed that bug: https://developer.unigine.com/forum/topic/5105-cigi-destroy-component-callback-is-never-called/

Next, open <SDK Browser>/sdks/<SDK VERSION>/source/plugins/Network/Syncker/source/SynckerMaster.cpp file and add this:

void Master::deleteNode(const NodePtr &node, int include_children)
{
	// ...
	
	// instead of this:
	// if (nodes_interpolation->isExist(node))
	//	   nodes_interpolation->removeNode(node);
	
	// put this:
	int sync_index = sync_nodes.findIndex(node);
	if (sync_index != -1)
		removeSyncNode(sync_index);
	
	// ...
}

It will fix the crash.
 

Best regards,
Alexander

Link to comment

Hello,

For the callback, after applying the patch and replacing the correct binary, it still doesn't call the destroy callback :( Am i missing something?

For the crash, it does fix it, al least partially. I still get an access violation in some cases. Now I'm trying to narrow it.

Link to comment

Hi,

Am i missing something?
Sorry, my bad. Open and modify the <SDK Browser>/sdks/<SDK VERSION>/source/plugins/Network/CigiClient/architecture/Entity.cpp file:

void Cigi::Entity::setType(int in_type)
{
	if (type == in_type)
		return;
	
	// run callback
	if (on_before_change_type)
		on_before_change_type->run(this);

	//type = in_type; // REMOVE THIS LINE!!!

	node->setName(String::format("cigi_entity_dummy (id: %d type: %d)", entity_id, type).get());

	// destroy old noderef (if it was created)
	if (node_ref)
		node_ref.destroy();

	// destroy all components and articulated parts, attached to this entity type
	destroy_all();

	type = in_type; // ADD THIS LINE!!!

	auto et = entity_types.find(type);
	if (et == entity_types.end())
		return;

// ...
// ...
// ...

(change position of the "type = in_type" line)

Best regards,
Alexander

  • Like 1
Link to comment
×
×
  • Create New...