From 166eaeb7db48232cfac460d8d6d8d8476e7a8664 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 11 Aug 2014 19:38:21 -0400 Subject: Revert "Revert "Settled race condition TODOs across all platforms... as an unfortunate case :("" Put this back on master so we can debug. This reverts commit 67adbd43a1bbf35fdc3963b34ae5631758006fee. --- redo/table_unix.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'redo/table_unix.go') diff --git a/redo/table_unix.go b/redo/table_unix.go index 611beae..d618663 100644 --- a/redo/table_unix.go +++ b/redo/table_unix.go @@ -58,13 +58,17 @@ func (t *table) Lock() { func (t *table) Unlock() { t.unlock() - // TODO RACE CONDITION HERE - // not sure about this one... - t.RLock() - defer t.RUnlock() - d := reflect.Indirect(reflect.ValueOf(t.data)) - new := C.gint(d.Len()) - C.tableUpdate(t.model, t.old, new) + // 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() + d := reflect.Indirect(reflect.ValueOf(t.data)) + new := C.gint(d.Len()) + C.tableUpdate(t.model, t.old, new) + }) + }() } //export goTableModel_get_n_columns -- cgit v1.2.3