diff --git a/Frameworks/RSTree/RSTree/Node.swift b/Frameworks/RSTree/RSTree/Node.swift index 618bad9d4..bf2270253 100644 --- a/Frameworks/RSTree/RSTree/Node.swift +++ b/Frameworks/RSTree/RSTree/Node.swift @@ -8,6 +8,8 @@ import Foundation +// Main thread only. + public final class Node: Hashable { public weak var parent: Node? @@ -17,7 +19,6 @@ public final class Node: Hashable { public var childNodes: [Node]? public let hashValue: Int private static var incrementingID = 0 - private static var incrementingIDLock = NSLock() public var isRoot: Bool { get { @@ -63,14 +64,14 @@ public final class Node: Hashable { } public init(representedObject: AnyObject, parent: Node?) { - + + precondition(Thread.isMainThread) + self.representedObject = representedObject self.parent = parent - Node.incrementingIDLock.lock() self.hashValue = Node.incrementingID Node.incrementingID += 1 - Node.incrementingIDLock.unlock() } public class func genericRootNode() -> Node {