← Back to team overview

kicad-developers team mailing list archive

Re: [Patch] pcbnew clipboard support

 

Thank you Tomasz!

That was most likely the error, I cannot reproduce the crash after fixing so that I do not modify the existing board!

I updated the branch, now bed for me!

- Kristofffer

On 09/18/2017 11:54 PM, Tomasz Wlostowski wrote:
On 18.09.2017 22:37, Kristoffer Ödmark wrote:
I have made almost no changes as of yet. Just trying to figure out what
causes the crash.

Hi,

Looking at kicad_clipboard.cpp:

// only a module selected.
     if( aSelected.Size() == 1 && aSelected.Front()->Type() == PCB_MODULE_T )
     {
         // make the module safe to transfer to other pcbs
         MODULE* mod = static_cast<MODULE*>( aSelected.Front() );
         for( D_PAD* pad = mod->PadsList().begin(); pad; pad = pad->Next() )
         {
             pad->SetNetCode( 0,0 );
         }

         Format(static_cast<BOARD_ITEM*>( mod ) );
     }

Why are you modifying the net codes of the items owned by the BOARD
class here? Shouldn't this be performed on a copy that to be formatted
for the clipboard? I noticed you're creating a stack MODULE object a few
lines up, but you're not using it in this particular case, could this be
the problem?

Tom




I noticed in pcbnew/tools/edit_tool.cpp cutToClipboard that the method
does not cause a crash If i only run on of the two method calls in it.
Doesnt matter which one I remove, I also noticed that the crash is due
to a CN_ANCHOR not being valid.

#4  0x00007fffe5cd1ab3 in CN_ANCHOR::Parent (this=0x5555588178a0) at
/home/krille/projects/kicad/pcbnew/connectivity_algo.cpp:924
924        assert( m_item->Valid() );
(gdb) p *m_item
$1 = {<INTRUSIVE_LIST<CN_ITEM>> = {m_count = 1484021408, m_prev =
0x670000006e, m_next = 0x2200000020, m_root = 0x6c00000025},
_vptr.CN_ITEM = 0x55555753f9c0, m_parent = 0x2200000073, m_connected =
std::vector of length -40802189302, capacity 1610612745 = {<error
reading variable>


On 09/18/2017 09:44 PM, Tomasz Wlostowski wrote:
On 18.09.2017 21:18, Kristoffer Ödmark wrote:
I cannot reproduce the crash on copying, I can however crash it on the
Cut functionality, I am at a total loss as to why though.

I noticed that the crash does not happen if one hides the board
ratsnest, but it will later crash when trying to re-enable the ratsnest.

Can someone maybe help shed some light on this?
Push the latest code, if it's ratsnest-related, I might have a look.

Tom

On 09/18/2017 01:35 PM, Tomasz Wlostowski wrote:
On 18.09.2017 12:57, Kristoffer Ödmark wrote:
Hmm, I cannot manage to reproduce the crash.

The things you are testing on, is the components pasted in using an
earlier version?

Hi Kristoffer,

Open the attached board, select P19 (connector on the right side) and
press Ctrl-C. A segfault will occur (at least on my machine) - release
x86_64 build.

PS. Why all the zones are refilled after pasting something? Is this
intentional?

Tom







References