ecere/gui/ListBox: Fixed clearing of data in UnsetData()
authorJerome St-Louis <jerome@ecere.com>
Tue, 5 Jan 2016 21:04:54 +0000 (16:04 -0500)
committerJerome St-Louis <jerome@ecere.com>
Tue, 5 Jan 2016 21:04:54 +0000 (16:04 -0500)
- After clearing cell, editor would be populated with previous value

ecere/src/gui/controls/ListBox.ec

index da9fe0b..cb5cb37 100644 (file)
@@ -662,8 +662,11 @@ public:
                }
                else
                {
+                  int size = (field.dataType && field.dataType.typeSize) ?
+                     (sizeof(class ListBoxCell) + field.dataType.typeSize - sizeof(void *)) : sizeof(class ListBoxCell);
                   // Free old data first
                   ((void (*)(void *, void *))(void *)dataType._vTbl[__ecereVMethodID_class_OnFree])(dataType, cell.data);
+                  FillBytes(cell.data, 0, size - (uint)(uintptr)&((ListBoxCell)0).data);
                }
             }
             cell.isSet = false;