Don't copy embedded files for temp objects

Just takes a long time and we throw it away a ms later

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22547

(cherry picked from commit d94d2c9a05)
This commit is contained in:
Seth Hillbrand
2025-12-18 13:05:37 -08:00
parent f3079700dd
commit 016dc47ec2
5 changed files with 24 additions and 4 deletions
+15
View File
@@ -591,6 +591,21 @@ EMBEDDED_FILES::EMBEDDED_FILES( const EMBEDDED_FILES& other ) :
}
EMBEDDED_FILES::EMBEDDED_FILES( const EMBEDDED_FILES& other, bool aDeepCopy ) :
m_embedFonts( other.m_embedFonts )
{
if( aDeepCopy )
{
for( const auto& [name, file] : other.m_files )
m_files[name] = new EMBEDDED_FILE( *file );
m_fontFiles = other.m_fontFiles;
}
m_fileAddedCallback = other.m_fileAddedCallback;
}
// Copy assignment operator
EMBEDDED_FILES& EMBEDDED_FILES::operator=( const EMBEDDED_FILES& other )
{
+3 -2
View File
@@ -165,9 +165,10 @@ LIB_SYMBOL::LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent, SYMBOL_LIB*
}
LIB_SYMBOL::LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary ) :
LIB_SYMBOL::LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary,
bool aCopyEmbeddedFiles ) :
SYMBOL( aSymbol ),
EMBEDDED_FILES( aSymbol ),
EMBEDDED_FILES( aSymbol, aCopyEmbeddedFiles ),
m_me( this, null_deleter() )
{
m_library = aLibrary;
+2 -1
View File
@@ -84,7 +84,8 @@ public:
LIB_SYMBOL( const wxString& aName, LIB_SYMBOL* aParent = nullptr,
SYMBOL_LIB* aLibrary = nullptr );
LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary = nullptr );
LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary = nullptr,
bool aCopyEmbeddedFiles = true );
virtual ~LIB_SYMBOL()
{}
+3 -1
View File
@@ -2091,7 +2091,8 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
std::vector<SCH_PIN*> originalPins = originalSymbol->GetPins( unit, bodyStyle );
// Copy the source so we can re-orient and translate it.
LIB_SYMBOL tempSymbol( *originalSymbol );
LIB_SYMBOL tempSymbol( *originalSymbol, nullptr, false );
std::vector<SCH_PIN*> tempPins = tempSymbol.GetPins( unit, bodyStyle );
tempSymbol.SetFlags( aSymbol->GetFlags() );
@@ -2219,6 +2220,7 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
m_gal->SetFillColor( marker_color );
m_gal->DrawCurve( left, top, bottom, right, 1 );
}
}
+1
View File
@@ -103,6 +103,7 @@ public:
EMBEDDED_FILES( EMBEDDED_FILES&& other ) noexcept;
EMBEDDED_FILES( const EMBEDDED_FILES& other );
EMBEDDED_FILES( const EMBEDDED_FILES& other, bool aDeepCopy );
~EMBEDDED_FILES()
{