diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-11 14:16:23 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-11 14:16:23 -0400 |
| commit | b198a4dfec53a15eac5cdca9fe9d91c145a0119c (patch) | |
| tree | 349c184a965ae4c78c011982a915d6f8cffc77f7 /redo/table_windows.go | |
| parent | 5d4fd8169b3d13ff1d0ccb6592cd925bcd2d8c80 (diff) | |
Settled race condition TODOs across all platforms... as an unfortunate case :(
Diffstat (limited to 'redo/table_windows.go')
| -rw-r--r-- | redo/table_windows.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/redo/table_windows.go b/redo/table_windows.go index 576ae4a..be9427e 100644 --- a/redo/table_windows.go +++ b/redo/table_windows.go @@ -38,11 +38,15 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table { func (t *table) Unlock() { t.unlock() - // TODO RACE CONDITION HERE - // I think there's a way to set the item count without causing a refetch of data that works around this... - t.RLock() - defer t.RUnlock() - C.tableUpdate(t._hwnd, C.int(reflect.Indirect(reflect.ValueOf(t.data)).Len())) + // there's a possibility that user actions can happen at this point, before the view is updated + // alas, this is something we have to deal with, because Unlock() can be called from any thread + go func() { + Do(func() { + t.RLock() + defer t.RUnlock() + C.tableUpdate(t._hwnd, C.int(reflect.Indirect(reflect.ValueOf(t.data)).Len())) + }) + }() } //export tableGetCellText |
