Fixed some coverity warnings.
Made Atomic constructor explicit. Cleared TreeViewItem parent pointers when they are removed.