Modify SerPartContent to remove old content when content is null
authorSungHyun Min <shyun.min@samsung.com>
Thu, 27 Oct 2016 01:30:36 +0000 (10:30 +0900)
committerSungHyun Min <shyun.min@samsung.com>
Thu, 27 Oct 2016 01:30:55 +0000 (10:30 +0900)
Signed-off-by: SungHyun Min <shyun.min@samsung.com>
Change-Id: I668f5702bb9b9418f94fc44de1eab404d23277a6

ElmSharp/ElmSharp/ItemObject.cs [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index fb44251..7843ef6
@@ -77,9 +77,10 @@ namespace ElmSharp
 
         public void SetPartContent(string part, EvasObject content, bool preserveOldContent)
         {
-            if (preserveOldContent)
+            IntPtr oldContent = Interop.Elementary.elm_object_item_part_content_unset(Handle, part);
+            if (oldContent != IntPtr.Zero && !preserveOldContent)
             {
-                Interop.Elementary.elm_object_item_part_content_unset(Handle, part);
+                Interop.Evas.evas_object_del(oldContent);
             }
             Interop.Elementary.elm_object_item_part_content_set(Handle, part, content);
             _partContents[part ?? "__default__"] = content;