Store annotation pointers as shared_ptr.

This commit is contained in:
Bartosz Taudul
2026-06-02 01:13:33 +02:00
parent 98b61e0096
commit c570288145
4 changed files with 6 additions and 6 deletions

View File

@@ -174,7 +174,7 @@ void UserData::StateShouldBePreserved()
m_preserveState = true;
}
void UserData::LoadAnnotations( std::vector<std::unique_ptr<Annotation>>& data )
void UserData::LoadAnnotations( std::vector<std::shared_ptr<Annotation>>& data )
{
assert( Valid() );
FILE* f = OpenFile( FileAnnotations, false );
@@ -211,7 +211,7 @@ void UserData::LoadAnnotations( std::vector<std::unique_ptr<Annotation>>& data )
}
}
void UserData::StoreAnnotations( const std::vector<std::unique_ptr<Annotation>>& data )
void UserData::StoreAnnotations( const std::vector<std::shared_ptr<Annotation>>& data )
{
if( !m_preserveState ) return;
if( data.empty() )

View File

@@ -30,8 +30,8 @@ public:
void StoreState( const ViewData& data );
void StateShouldBePreserved();
void LoadAnnotations( std::vector<std::unique_ptr<Annotation>>& data );
void StoreAnnotations( const std::vector<std::unique_ptr<Annotation>>& data );
void LoadAnnotations( std::vector<std::shared_ptr<Annotation>>& data );
void StoreAnnotations( const std::vector<std::shared_ptr<Annotation>>& data );
void LoadSourceSubstitutions( std::vector<SourceRegex>& data );
void StoreSourceSubstitutions( const std::vector<SourceRegex>& data );

View File

@@ -680,7 +680,7 @@ private:
FrameImageCache m_FrameTextureCache;
FrameImageCache m_FrameTextureCacheConnection;
std::vector<std::unique_ptr<Annotation>> m_annotations;
std::vector<std::shared_ptr<Annotation>> m_annotations;
UserData m_userData;
alignas(64) std::atomic<bool> m_wasActive { false };

View File

@@ -9,7 +9,7 @@ namespace tracy
void View::AddAnnotation( int64_t start, int64_t end )
{
auto ann = std::make_unique<Annotation>();
auto ann = std::make_shared<Annotation>();
ann->range.active = true;
ann->range.min = start;
ann->range.max = end;