Indicator::LockFile::~LockFile()
{
// Closing file descriptor also unlocks file.
- close( mFileDescriptor );
+ if( mFileDescriptor > 0 )
+ {
+ close( mFileDescriptor );
+ }
}
bool Indicator::LockFile::Lock()
{
DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
- struct flock filelock;
-
- filelock.l_type = F_UNLCK;
- filelock.l_whence = SEEK_SET;
- filelock.l_start = 0;
- filelock.l_len = 0;
- if (fcntl(mFileDescriptor, F_SETLKW, &filelock) == -1)
+ if( mFileDescriptor > 0 )
{
- mErrorThrown = true;
- DALI_LOG_ERROR( "### Failed to lock with fd : %s ###\n", mFilename.c_str() );
+ struct flock filelock;
+
+ filelock.l_type = F_UNLCK;
+ filelock.l_whence = SEEK_SET;
+ filelock.l_start = 0;
+ filelock.l_len = 0;
+ if (fcntl(mFileDescriptor, F_SETLKW, &filelock) == -1)
+ {
+ mErrorThrown = true;
+ DALI_LOG_ERROR( "### Failed to lock with fd : %s ###\n", mFilename.c_str() );
+ }
}
}
{
DALI_LOG_ERROR( "### Indicator error: Cannot open lock file %s ###\n", mSharedFileInfo[n].mLockFileName.c_str() );
}
-
- CreateNewImage( n );
- UpdateVisibility();
+ else
+ {
+ CreateNewImage( n );
+ UpdateVisibility();
+ }
}
}
}
if( !success )
{
- DALI_LOG_WARNING("### Cannot create indicator image - disconnecting ###\n");
- Disconnect();
- if( mObserver != NULL )
- {
- mObserver->IndicatorClosed( this );
- }
- // Don't do connection in this callback - strange things happen!
- StartReconnectionTimer();
+ DALI_LOG_WARNING("### Cannot create indicator image ###\n");
}
}