summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-12-12 23:53:27 -0500
committerPietro Gagliardi <[email protected]>2015-12-12 23:53:27 -0500
commite7e3ea052969c6905c1acb49a16cfe23798bb9ff (patch)
treed44183f7631c9493382b18dad6afaa08b3cd6501
parent38c3288c6b5a9a57374e1645ee11753364747231 (diff)
Fixed a latent bug in Tab.InsertAt() where inserted controls are appended to t.children, causing issues during Tab.Destroy().
-rw-r--r--tab.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/tab.go b/tab.go
index 69a062a..d18cecd 100644
--- a/tab.go
+++ b/tab.go
@@ -94,7 +94,12 @@ func (t *Tab) InsertAt(name string, n int, child Control) {
// TODO why is this uintmax_t and not intmax_t
C.uiTabInsertAt(t.t, cname, C.uintmax_t(n), c)
freestr(cname)
- t.children = append(t.children, child)
+ ch := make([]Control, len(t.children) + 1)
+ // and insert into t.children at the right place
+ copy(ch[:n], t.children[:n])
+ ch[n] = child
+ copy(ch[n + 1:], t.children[n:])
+ t.children = ch
}
// Delete deletes the nth page of the Tab.