[Calendar] Fix AddChangedCb parameter to callbackmap, remove throw in Dispose 07/153407/4 preview1-00268
authorJeesun Kim <iamjs.kim@samsung.com>
Thu, 28 Sep 2017 09:16:42 +0000 (18:16 +0900)
committerjeesun kim <iamjs.kim@samsung.com>
Fri, 29 Sep 2017 00:36:59 +0000 (00:36 +0000)
Change-Id: I7a50078ce9dad34cc4a40e9a7e55ac9a8a1e7ef2

src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs
src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarFilter.cs
src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs
src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs
src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarQuery.cs
src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.cs

index 5592b33..3bd2ca9 100644 (file)
@@ -34,7 +34,6 @@ namespace Tizen.Pims.Calendar
         private Object thisLock = new Object();
         private Dictionary<string, EventHandler<DBChangedEventArgs>> _eventHandlerMap = new Dictionary<string, EventHandler<DBChangedEventArgs>>();
         private Dictionary<string, Interop.Database.DBChangedCallback> _callbackMap = new Dictionary<string, Interop.Database.DBChangedCallback>();
-        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);
index 53ef5a9..e121fcc 100644 (file)
@@ -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;
             }
index b85e07d..4430b45 100644 (file)
@@ -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);
index 28cc865..2695408 100644 (file)
@@ -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;
             }
index 94dbdc4..980903c 100644 (file)
@@ -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;
             }
index bafeb79..8eb9603 100644 (file)
@@ -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);