Disconnect from region change callback if AOEngine gets destroyed

Ansariel 2014-07-25 07:53:23 +02:00
parent 4200044961
commit 470a273529
2 changed files with 8 additions and 1 deletions

View File

@ -66,12 +66,17 @@ AOEngine::AOEngine() :
{
gSavedPerAccountSettings.getControl("UseAO")->getCommitSignal()->connect(boost::bind(&AOEngine::onToggleAOControl, this));
gAgent.addRegionChangedCallback(boost::bind(&AOEngine::onRegionChange, this));
mRegionChangeConnection = gAgent.addRegionChangedCallback(boost::bind(&AOEngine::onRegionChange, this));
}
AOEngine::~AOEngine()
{
clear(false);
if (mRegionChangeConnection.connected())
{
mRegionChangeConnection.disconnect();
}
}
void AOEngine::init()

View File

@ -214,6 +214,8 @@ class AOEngine
std::vector<AOSet*> mOldImportSets;
LLUUID mImportCategory;
S32 mImportRetryCount;
boost::signals2::connection mRegionChangeConnection;
};
#endif // AOENGINE_H