summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Ivy/Ivy.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/Ivy/Ivy.cxx b/Ivy/Ivy.cxx
index b592c11..e7505d1 100644
--- a/Ivy/Ivy.cxx
+++ b/Ivy/Ivy.cxx
@@ -260,18 +260,20 @@ void Ivy::SendDieMsg( IvyApplication *app )
}
IvyApplication * Ivy::GetApplication(const char *name)
{
+ IvyApplication *app = NULL;
EnterCriticalSection( &m_application_cs );
IvyApplicationList::iterator iter;
for ( iter = applications.begin() ; iter != applications.end() ; )
{
- IvyApplication *app = *iter++;
- if ( (app->m_hSocket != INVALID_SOCKET) && app->appname == name )
+ IvyApplication *ap = *iter++;
+ if ( (ap->m_hSocket != INVALID_SOCKET) && ap->appname == name )
{
- return app;
+ app = ap;
+ break; // dont return because of LeaveCriticalSection !!!
}
}
LeaveCriticalSection( &m_application_cs );
- return NULL;
+ return app;
}