Use shared_ptr for selectedArea.