Update for removing the leaked file descriptor
authorJaesung Ku <jaesung.ku@samsung.com>
Wed, 24 Apr 2013 05:11:49 +0000 (14:11 +0900)
committerJaesung Ku <jaesung.ku@samsung.com>
Wed, 24 Apr 2013 05:12:47 +0000 (14:12 +0900)
Change-Id: I04f4cefa813174ae5382ce9cfad6491e517f9c30
Signed-off-by: Jaesung Ku <jaesung.ku@samsung.com>
src/base/runtime/FBaseRt_EventDispatcher.cpp [changed mode: 0644->0755]
src/base/runtime/FBaseRt_EventDrivenThreadImpl.cpp [changed mode: 0644->0755]
src/base/runtime/FBaseRt_EventDrivenThreadImpl.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index d1bd46d..5063090
@@ -70,6 +70,7 @@ _EventDispatcher::~_EventDispatcher(void)
                delete __pMutex;
                __pMutex = null;
        }
+       g_main_context_unref(__pGMainContext);
 }
 
 result
@@ -80,7 +81,6 @@ _EventDispatcher::Construct(GMainContext* pGMainContext)
        int eventFd = -1;
 
        __pGMainContext = pGMainContext;
-       g_main_context_ref(__pGMainContext);
 
        eventFd = eventfd(0, 0);
        SysTryCatch(NID_BASE_RT, -1 != eventFd, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to open eventfd.");
old mode 100644 (file)
new mode 100755 (executable)
index e1e3e93..bca314c
@@ -36,6 +36,7 @@ _EventDrivenThreadImpl::_EventDrivenThreadImpl(Thread& thread, const String& nam
        , __pEventDispatcher(null)
        , __pEventManager(null)
        , __pEvent(null)
+       , __pGmainContext(null)
 {
 
 }
@@ -45,6 +46,7 @@ _EventDrivenThreadImpl::~_EventDrivenThreadImpl(void)
        delete __pEventDispatcher;
        delete __pEventManager;
        delete __pEvent;
+       g_main_context_unref(__pGmainContext);
 }
 
 result
@@ -127,6 +129,7 @@ _EventDrivenThreadImpl::Initialize(void)
        __pEventDispatcher = new (std::nothrow) _EventDispatcher();
        __pEventDispatcher->Construct(pGMainContext);
 
+       __pGmainContext = pGMainContext;
        return E_SUCCESS;
 
 CATCH:
old mode 100644 (file)
new mode 100755 (executable)
index 1c5ed05..29beb7a
@@ -69,6 +69,7 @@ private:
        _EventDispatcher* __pEventDispatcher;
        _EventManager* __pEventManager;
        _EventDrivenThreadEvent* __pEvent;
+       GMainContext* __pGmainContext;
        Tizen::Base::Collection::LinkedListT <_EventDrivenThreadEventArg*> __pendingEvents;
 };