correctly handle multiple registrations of the same snipclass name
svn: r15692
This commit is contained in:
parent
a090aa60a9
commit
3170f05da2
|
@ -1238,10 +1238,14 @@
|
|||
|
||||
(def/public (add [snip-class% c])
|
||||
(let ([name (send c get-classname)])
|
||||
(let ([old (hash-ref ht name #f)])
|
||||
(hash-set! ht name c)
|
||||
(let ([n (hash-count pos-ht)])
|
||||
(let ([n (if old
|
||||
(hash-ref pos-ht old)
|
||||
(hash-count pos-ht))])
|
||||
(when old (hash-remove! pos-ht old))
|
||||
(hash-set! pos-ht c n)
|
||||
(hash-set! rev-pos-ht n c))))
|
||||
(hash-set! rev-pos-ht n c)))))
|
||||
|
||||
(def/public (number) (hash-count ht))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user