Settled race condition TODOs across all platforms... as an unfortunate case :(
This commit is contained in:
parent
5d4fd8169b
commit
b198a4dfec
|
@ -36,11 +36,15 @@ func finishNewTable(b *tablebase, ty reflect.Type) Table {
|
|||
|
||||
func (t *table) Unlock() {
|
||||
t.unlock()
|
||||
// TODO RACE CONDITION HERE
|
||||
// not sure about this one...
|
||||
// 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._id)
|
||||
})
|
||||
}()
|
||||
}
|
||||
|
||||
//export goTableDataSource_getValue
|
||||
|
|
|
@ -58,13 +58,17 @@ func (t *table) Lock() {
|
|||
|
||||
func (t *table) Unlock() {
|
||||
t.unlock()
|
||||
// TODO RACE CONDITION HERE
|
||||
// not sure about this one...
|
||||
// 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
|
||||
|
|
|
@ -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...
|
||||
// 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
|
||||
|
|
Loading…
Reference in New Issue