diff --git a/eeschema/eeschema_jobs_handler.cpp b/eeschema/eeschema_jobs_handler.cpp index 3f64b72f31..c2ff53910f 100644 --- a/eeschema/eeschema_jobs_handler.cpp +++ b/eeschema/eeschema_jobs_handler.cpp @@ -624,11 +624,10 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob, // if the symbol is an alias, then the draw items are stored in the root symbol if( symbol->IsAlias() ) { - LIB_SYMBOL_SPTR parent = symbol->GetRootSymbol().lock(); - - wxCHECK( parent, CLI::EXIT_CODES::ERR_UNKNOWN ); - - symbolToPlot = parent.get(); + if( LIB_SYMBOL_SPTR parent = symbol->GetRootSymbol() ) + symbolToPlot = parent.get(); + else + wxCHECK( false, CLI::EXIT_CODES::ERR_UNKNOWN ); } if( aSvgJob->m_includeHiddenPins ) diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 706a83c9db..462dbdec13 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -534,7 +534,7 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags, REPORTER* aR } -LIB_SYMBOL_REF LIB_SYMBOL::GetRootSymbol() const +LIB_SYMBOL_SPTR LIB_SYMBOL::GetRootSymbol() const { const LIB_SYMBOL_SPTR sp = m_parent.lock(); @@ -2047,4 +2047,4 @@ double LIB_SYMBOL::Similarity( const LIB_SYMBOL& aOther ) const similarity *= 0.9; return similarity; -} \ No newline at end of file +} diff --git a/eeschema/lib_symbol.h b/eeschema/lib_symbol.h index db1223386d..a97970cd6b 100644 --- a/eeschema/lib_symbol.h +++ b/eeschema/lib_symbol.h @@ -142,7 +142,7 @@ public: * * @return the weak_ptr to the root symbol of this symbol. */ - LIB_SYMBOL_REF GetRootSymbol() const; + LIB_SYMBOL_SPTR GetRootSymbol() const; void ClearCaches(); diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp index fce6cb16e2..f4d043c2f0 100644 --- a/eeschema/project_rescue.cpp +++ b/eeschema/project_rescue.cpp @@ -436,7 +436,7 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues( // If it's a derive symbol, use the parent symbol to perform the pin test. if( lib_match && lib_match->IsAlias() ) { - lib_match_parent = lib_match->GetRootSymbol().lock(); + lib_match_parent = lib_match->GetRootSymbol(); if( !lib_match_parent ) lib_match = nullptr; diff --git a/eeschema/sch_view.cpp b/eeschema/sch_view.cpp index 11279bb89f..3c2e559eb9 100644 --- a/eeschema/sch_view.cpp +++ b/eeschema/sch_view.cpp @@ -160,7 +160,7 @@ void SCH_VIEW::DisplaySymbol( LIB_SYMBOL* aSymbol ) // Draw the parent items if the symbol is inherited from another symbol. if( aSymbol->IsAlias() ) { - if( std::shared_ptr< LIB_SYMBOL > parent = aSymbol->GetRootSymbol().lock() ) + if( std::shared_ptr< LIB_SYMBOL > parent = aSymbol->GetRootSymbol() ) drawnSymbol = parent.get(); else { diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index b48f13551d..80d8a3563d 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -829,7 +829,7 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom ) wxString rootSymbolName; // Don't assume the parent symbol shared pointer is still valid. - if( std::shared_ptr rootSymbol = m_symbol->GetRootSymbol().lock() ) + if( std::shared_ptr rootSymbol = m_symbol->GetRootSymbol() ) rootSymbolName = rootSymbol->GetName(); else { diff --git a/qa/tests/eeschema/test_lib_part.cpp b/qa/tests/eeschema/test_lib_part.cpp index 6e3745dc48..6213c21c17 100644 --- a/qa/tests/eeschema/test_lib_part.cpp +++ b/qa/tests/eeschema/test_lib_part.cpp @@ -607,9 +607,9 @@ BOOST_AUTO_TEST_CASE( Inheritance ) BOOST_CHECK( grandChild->IsAlias() ); BOOST_CHECK_EQUAL( grandChild->GetInheritanceDepth(), 2 ); - BOOST_CHECK( parent->GetRootSymbol().lock().get() == parent.get() ); - BOOST_CHECK( child->GetRootSymbol().lock().get() == parent.get() ); - BOOST_CHECK( grandChild->GetRootSymbol().lock().get() == parent.get() ); + BOOST_CHECK( parent->GetRootSymbol().get() == parent.get() ); + BOOST_CHECK( child->GetRootSymbol().get() == parent.get() ); + BOOST_CHECK( grandChild->GetRootSymbol().get() == parent.get() ); LIB_SYMBOL_SPTR parentRef = child->GetParent().lock(); BOOST_CHECK( parentRef );