History

Remove dangling packet sender pointer before it's invalid.

Simon Walton committed 8 years ago

Commit 4fd6eb51 parent d67044f1 file · +8 −1Browse files

Showing the changes to assignment-client/src/scripts/EntityScriptServer.cpp (1 of 1 file). Show all

Unified · Split

assignment-client/src/scripts/EntityScriptServer.cpp+8−1
@@ -566,8 +566,15 @@ void EntityScriptServer::handleOctreePacket(QSharedPointer<ReceivedMessage> mess · 565 unmodified lines
566566 void EntityScriptServer::aboutToFinish() {
567567 shutdownScriptEngine();
568568
569+ auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
569570 // our entity tree is going to go away so tell that to the EntityScriptingInterface
570− DependencyManager::get<EntityScriptingInterface>()->setEntityTree(nullptr);
571+ entityScriptingInterface->setEntityTree(nullptr);
572+
573+ // Should always be true as they are singletons.
574+ if (entityScriptingInterface->getPacketSender() == &_entityEditSender) {
575+ // The packet sender is about to go away.
576+ entityScriptingInterface->setPacketSender(nullptr);
577+ }
571578
572579 DependencyManager::get<ResourceManager>()->cleanup();
573580