From e0625e0366feac265daace34db55dc0829d770bb Mon Sep 17 00:00:00 2001 From: Jeesun Kim Date: Thu, 28 Sep 2017 18:16:42 +0900 Subject: [PATCH] [Calendar] Fix AddChangedCb parameter to callbackmap, remove throw in Dispose Change-Id: I7a50078ce9dad34cc4a40e9a7e55ac9a8a1e7ef2 --- src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs | 3 +-- src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarFilter.cs | 6 +++++- src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs | 1 - src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs | 1 - src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarQuery.cs | 1 - src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.cs | 1 - 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs index 5592b33..3bd2ca9 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs @@ -34,7 +34,6 @@ namespace Tizen.Pims.Calendar private Object thisLock = new Object(); private Dictionary> _eventHandlerMap = new Dictionary>(); private Dictionary _callbackMap = new Dictionary(); - private Interop.Database.DBChangedCallback _dbChangedDelegate; internal CalendarDatabase() { @@ -536,7 +535,7 @@ namespace Tizen.Pims.Calendar _eventHandlerMap[uri]?.Invoke(this, args); }; - int error = Interop.Database.AddChangedCallback(viewUri, _dbChangedDelegate, IntPtr.Zero); + int error = Interop.Database.AddChangedCallback(viewUri, _callbackMap[viewUri], IntPtr.Zero); if (CalendarError.None != (CalendarError)error) { Log.Error(Globals.LogTag, "AddDBChangedDelegate Failed with error " + error); diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarFilter.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarFilter.cs index 53ef5a9..e121fcc 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarFilter.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarFilter.cs @@ -53,6 +53,7 @@ namespace Tizen.Pims.Calendar error = Interop.Filter.AddString(_filterHandle, propertyId, matchType, matchValue); if (CalendarError.None != (CalendarError)error) { + Interop.Filter.Destroy(_filterHandle); Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); throw CalendarErrorFactory.GetException(error); } @@ -84,6 +85,7 @@ namespace Tizen.Pims.Calendar error = Interop.Filter.AddInteger(_filterHandle, propertyId, matchType, matchValue); if (CalendarError.None != (CalendarError)error) { + Interop.Filter.Destroy(_filterHandle); Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); throw CalendarErrorFactory.GetException(error); } @@ -115,6 +117,7 @@ namespace Tizen.Pims.Calendar error = Interop.Filter.AddLong(_filterHandle, propertyId, matchType, matchValue); if (CalendarError.None != (CalendarError)error) { + Interop.Filter.Destroy(_filterHandle); Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); throw CalendarErrorFactory.GetException(error); } @@ -146,6 +149,7 @@ namespace Tizen.Pims.Calendar error = Interop.Filter.AddDouble(_filterHandle, propertyId, matchType, matchValue); if (CalendarError.None != (CalendarError)error) { + Interop.Filter.Destroy(_filterHandle); Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); throw CalendarErrorFactory.GetException(error); } @@ -178,6 +182,7 @@ namespace Tizen.Pims.Calendar error = Interop.Filter.AddCalendarTime(_filterHandle, propertyId, matchType, time); if (CalendarError.None != (CalendarError)error) { + Interop.Filter.Destroy(_filterHandle); Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); throw CalendarErrorFactory.GetException(error); } @@ -289,7 +294,6 @@ namespace Tizen.Pims.Calendar if (CalendarError.None != (CalendarError)error) { Log.Error(Globals.LogTag, "Destroy Failed with error " + error); - throw CalendarErrorFactory.GetException(error); } disposedValue = true; } diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs index b85e07d..4430b45 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs @@ -102,7 +102,6 @@ namespace Tizen.Pims.Calendar if (CalendarError.None != (CalendarError)error) { Log.Error(Globals.LogTag, "Destroy Failed with error " + error); - throw CalendarErrorFactory.GetException(error); } disposedValue = true; GC.RemoveMemoryPressure(_memoryPressure); diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs index 28cc865..2695408 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs @@ -70,7 +70,6 @@ namespace Tizen.Pims.Calendar if (CalendarError.None != (CalendarError)error) { Log.Error(Globals.LogTag, "Disconnect Failed with error " + error); - throw CalendarErrorFactory.GetException(error); } disposedValue = true; } diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarQuery.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarQuery.cs index 94dbdc4..980903c 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarQuery.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarQuery.cs @@ -83,7 +83,6 @@ namespace Tizen.Pims.Calendar if (CalendarError.None != (CalendarError)error) { Log.Error(Globals.LogTag, "CalendarQueryDestroy Failed with error " + error); - throw CalendarErrorFactory.GetException(error); } disposedValue = true; } diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.cs index bafeb79..8eb9603 100644 --- a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.cs +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.cs @@ -137,7 +137,6 @@ namespace Tizen.Pims.Calendar if (CalendarError.None != (CalendarError)error) { Log.Error(Globals.LogTag, "Destroy Failed with error " + error); - throw CalendarErrorFactory.GetException(error); } _disposedValue = true; GC.RemoveMemoryPressure(_memoryPressure); -- 2.7.4