From: Heeyong Song Date: Tue, 13 Jun 2017 07:05:44 +0000 (+0900) Subject: Fix indicator crash X-Git-Tag: dali_1.2.44~3^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=947713e1a33face353c1187925296ba3a596ddb3;ds=sidebyside Fix indicator crash Change-Id: I16f27d7627eee4328d92e6ed2d7db8e59e90f79d --- diff --git a/adaptors/ecore/common/ecore-indicator-impl.cpp b/adaptors/ecore/common/ecore-indicator-impl.cpp index 4ed4667..574e0bd 100644 --- a/adaptors/ecore/common/ecore-indicator-impl.cpp +++ b/adaptors/ecore/common/ecore-indicator-impl.cpp @@ -468,7 +468,10 @@ Indicator::LockFile::LockFile(const std::string filename) Indicator::LockFile::~LockFile() { // Closing file descriptor also unlocks file. - close( mFileDescriptor ); + if( mFileDescriptor > 0 ) + { + close( mFileDescriptor ); + } } bool Indicator::LockFile::Lock() @@ -507,16 +510,19 @@ void Indicator::LockFile::Unlock() { 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() ); + } } } @@ -1055,9 +1061,11 @@ void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent ) { DALI_LOG_ERROR( "### Indicator error: Cannot open lock file %s ###\n", mSharedFileInfo[n].mLockFileName.c_str() ); } - - CreateNewImage( n ); - UpdateVisibility(); + else + { + CreateNewImage( n ); + UpdateVisibility(); + } } } } @@ -1212,14 +1220,7 @@ void Indicator::CreateNewImage( int bufferNumber ) 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"); } }