Can you run with ASAN on (KICAD_SANITIZE in CMake) and see if you get
some info about why you get a segfault?
On Fri, Sep 25, 2020 at 10:28 AM Franck Jullien
<franck.jullien@xxxxxxxxx <mailto:franck.jullien@xxxxxxxxx>> wrote:
Hi,
I'm working on the intersheets references functionality and I'm
struggling with a segfault.
Until now, I didn't try to remove iref from sheets. Now, I do this
with:
void SCH_EDIT_FRAME::RemoveAllIntersheetsRefs()
{
SCH_SHEET_LIST sheets = Schematic().GetSheets();
SCH_GLOBALLABEL* gLabel;
m_labelTable.clear();
for( const SCH_SHEET_PATH& sheet : sheets )
{
SCH_SCREEN* screen = sheet.LastScreen();
for( SCH_ITEM* item : screen->Items() )
{
if( item->Type() == SCH_GLOBAL_LABEL_T )
{
gLabel = (SCH_GLOBALLABEL*)( item );
SCH_IREF* iref = gLabel->GetIref();
if( iref )
{
gLabel->SetIref( nullptr );
gLabel->SetIrefSavedPosition( wxDefaultPosition );
screen->DeleteItem( iref );
}
}
}
}
}
As soon as I call DeleteItem (or RemoveFromScreen) I get a crash.
Is there something obvious I don't see ?
I still need to get familiar with screens, sheets, frames, canvas,
views....
Thanks in advance.
Franck.