kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #44527
Re: Help needed
Thanks for the tip, I didn't know we could run ASAN with Kicad easily.
This is what I get:
==7559==ERROR: AddressSanitizer: heap-use-after-free on address
0x6120000403c4 at pc 0x7f1ec5130bb9 bp 0x7ffe8351d540 sp
0x7ffe8351d530
READ of size 4 at 0x6120000403c4 thread T0
#0 0x7f1ec5130bb8 in RTree<SCH_ITEM*, int, 3, double, 8,
4>::Node::IsLeaf() ../kicad/thirdparty/rtree/geometry/rtree.h:481
#1 0x7f1ec51311d9 in RTree<SCH_ITEM*, int, 3, double, 8,
4>::Iterator::FindNextData()
../kicad/thirdparty/rtree/geometry/rtree.h:353
#2 0x7f1ec512f08d in RTree<SCH_ITEM*, int, 3, double, 8,
4>::Iterator::operator++()
../kicad/thirdparty/rtree/geometry/rtree.h:316
#3 0x7f1ec5938152 in SCH_EDIT_FRAME::RemoveAllIntersheetsRefs()
../kicad/eeschema/sch_edit_frame.cpp:1284
#4 0x7f1ec5938599 in SCH_EDIT_FRAME::CommonSettingsChanged(bool,
bool) ../kicad/eeschema/sch_edit_frame.cpp:1315
.....
I'll take a look.
Le ven. 25 sept. 2020 à 16:32, Jon Evans <jon@xxxxxxxxxxxxx> a écrit :
>
> 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> 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.
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help : https://help.launchpad.net/ListHelp
References