fix(tsm1): Fix panic when calling Close twice on a descending cursor.

pull/10226/head
Stuart Carnie 2018-08-22 13:14:53 -07:00
parent 6150bc1eea
commit e685556c81
2 changed files with 24 additions and 12 deletions

View File

@ -210,8 +210,10 @@ func (c *floatArrayDescendingCursor) reset(seek, end int64, cacheValues Values,
func (c *floatArrayDescendingCursor) Err() error { return nil }
func (c *floatArrayDescendingCursor) Close() {
if c.tsm.keyCursor != nil {
c.tsm.keyCursor.Close()
c.tsm.keyCursor = nil
}
c.cache.values = nil
c.tsm.values = nil
}
@ -491,8 +493,10 @@ func (c *integerArrayDescendingCursor) reset(seek, end int64, cacheValues Values
func (c *integerArrayDescendingCursor) Err() error { return nil }
func (c *integerArrayDescendingCursor) Close() {
if c.tsm.keyCursor != nil {
c.tsm.keyCursor.Close()
c.tsm.keyCursor = nil
}
c.cache.values = nil
c.tsm.values = nil
}
@ -772,8 +776,10 @@ func (c *unsignedArrayDescendingCursor) reset(seek, end int64, cacheValues Value
func (c *unsignedArrayDescendingCursor) Err() error { return nil }
func (c *unsignedArrayDescendingCursor) Close() {
if c.tsm.keyCursor != nil {
c.tsm.keyCursor.Close()
c.tsm.keyCursor = nil
}
c.cache.values = nil
c.tsm.values = nil
}
@ -1053,8 +1059,10 @@ func (c *stringArrayDescendingCursor) reset(seek, end int64, cacheValues Values,
func (c *stringArrayDescendingCursor) Err() error { return nil }
func (c *stringArrayDescendingCursor) Close() {
if c.tsm.keyCursor != nil {
c.tsm.keyCursor.Close()
c.tsm.keyCursor = nil
}
c.cache.values = nil
c.tsm.values = nil
}
@ -1334,8 +1342,10 @@ func (c *booleanArrayDescendingCursor) reset(seek, end int64, cacheValues Values
func (c *booleanArrayDescendingCursor) Err() error { return nil }
func (c *booleanArrayDescendingCursor) Close() {
if c.tsm.keyCursor != nil {
c.tsm.keyCursor.Close()
c.tsm.keyCursor = nil
}
c.cache.values = nil
c.tsm.values = nil
}

View File

@ -212,8 +212,10 @@ func (c *{{$type}}) reset(seek, end int64, cacheValues Values, tsmKeyCursor *Key
func (c *{{$type}}) Err() error { return nil }
func (c *{{$type}}) Close() {
if c.tsm.keyCursor != nil {
c.tsm.keyCursor.Close()
c.tsm.keyCursor = nil
}
c.cache.values = nil
c.tsm.values = nil
}