← Back to team overview

kicad-developers team mailing list archive

Re: Bug 1834718

 

Hi Wayne-

That actually helps a lot. It also explains why this is MSW-only behavior.

I'm attaching a patch that should address this. Let me know if it doesn't help.

Best-
Seth

On 2019-06-29 11:48, Wayne Stambaugh wrote:
Seth,

I managed to let the gdb back trace finish. It took a while but here is
the last of the stack up to the last progress dialog dtor iteration.
I'm not sure how much good it's going to do.  It looks like there was a
context switch or something that corrupted the previous stack frame so
any useful information in that stack frame is lost :(

Wayne

#83262 0x000000006d26fb1d in ?? ()
   from E:\msys64\mingw64\bin\wxmsw30u_core_gcc_custom.dll
#83263 0x00000000806e8547 in WX_PROGRESS_REPORTER::~WX_PROGRESS_REPORTER (
    this=0x1751aca0, __in_chrg=<optimized out>)
    at
E:/msys64/home/Wayne/src/kicad-5.1/common/widgets/progress_reporter.cpp:117
#83264 0x00000000802d2d88 in POINT_EDITOR::finishItem (this=0x12a8a3a0)
at E:/msys64/home/Wayne/src/kicad-5.1/pcbnew/tools/point_editor.cpp:650
#83265 0x00000000802d15a0 in POINT_EDITOR::OnSelectionChange (
    this=0x12a8a3a0, aEvent=...)
at E:/msys64/home/Wayne/src/kicad-5.1/pcbnew/tools/point_editor.cpp:427
#83266 0x0000000080bc764f in std::__invoke_impl<int, int
(POINT_EDITOR::*&)(TOOL_EVENT const&), POINT_EDITOR*&, TOOL_EVENT
const&> (__f=
    @0x190138a0: (int (POINT_EDITOR::*)(class POINT_EDITOR * const,
const class TOOL_EVENT &)) 0x802d0b22
<POINT_EDITOR::OnSelectionChange(TOOL_EVENT const&)>, __t=@0x190138b0:
0x12a8a3a0, __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/invoke.h:73
#83267 0x0000000080c172b3 in std::__invoke<int
(POINT_EDITOR::*&)(TOOL_EVENT const&), POINT_EDITOR*&, TOOL_EVENT
const&> (__fn=
    @0x190138a0: (int (POINT_EDITOR::*)(class POINT_EDITOR * const,
const class TOOL_EVENT &)) 0x802d0b22
<POINT_EDITOR::OnSelectionChange(TOOL_EVENT const&)>,
__args#0=@0x190138b0: 0x12a8a3a0, __args#1=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/invoke.h:95
#83268 0x0000000080ab4fcb in std::_Bind<int
(POINT_EDITOR::*(POINT_EDITOR*, std::_Placeholder<1>))(TOOL_EVENT
const&)>::__call<int, TOOL_EVENT const&, 0ull,
1ull>(std::tuple<TOOL_EVENT const&>&&, std::_Index_tuple<0ull, 1ull>) (
    this=0x190138a0, __args=...)
    at E:/msys64/mingw64/include/c++/9.1.0/functional:400
#83269 0x0000000080ab50f4 in std::_Bind<int
(POINT_EDITOR::*(POINT_EDITOR*, std::_Placeholder<1>))(TOOL_EVENT
const&)>::operator()<TOOL_EVENT const&, int>(TOOL_EVENT const&)
(this=0x190138a0, __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/functional:484
#83270 0x0000000080a8fef9 in std::_Function_handler<int (TOOL_EVENT
const&), std::_Bind<int (POINT_EDITOR::*(POINT_EDITOR*,
std::_Placeholder<1>))(TOOL_EVENT const&)> >::_M_invoke(std::_Any_data
const&, TOOL_EVENT const&) (
    __functor=..., __args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/std_function.h:285
#83271 0x0000000080a0196b in std::function<int (TOOL_EVENT
const&)>::operator()(TOOL_EVENT const&) const (this=0x19011718,
__args#0=...)
    at E:/msys64/mingw64/include/c++/9.1.0/bits/std_function.h:690
#83272 0x0000000080958ffa in COROUTINE<int, TOOL_EVENT const&>::callerStub (
    aData=401672480)
    at E:/msys64/home/Wayne/src/kicad-5.1/include/tool/coroutine.h:332
#83273 0x00000000807b8d4a in make_fcontext ()
   from E:\msys64\mingw64\bin\_pcbnew.kiface
#83274 0x0000000017f10920 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)


On 6/28/2019 7:58 PM, Seth Hillbrand wrote:
Hi Wayne-

I can't get Linux to crash for this bug but I do see some memory access
grinding when I follow your steps.

Can you test the attached patch and see if it fixes the issue for you? 
Launchpad is down right now, so I can't attach it to the bug report.

This patch should not be committed to the tree.  If it fixes the issue,
we can address the root cause but that's a bigger job.

-Seth
From e1c9cc6ee2c84aa774ed57774f4033683b768d85 Mon Sep 17 00:00:00 2001
From: Seth Hillbrand <hillbrand@xxxxxxxxxxx>
Date: Sat, 29 Jun 2019 12:14:43 -0700
Subject: [PATCH] Move zone refill to action

This unifies the zone refill across architecture into the tool-based
architecture.
---
 pcbnew/tools/point_editor.cpp     | 16 +---------------
 pcbnew/tools/zone_filler_tool.cpp | 17 +++++++++++------
 2 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp
index 2b06c4a4e..2da09d751 100644
--- a/pcbnew/tools/point_editor.cpp
+++ b/pcbnew/tools/point_editor.cpp
@@ -637,21 +637,7 @@ void POINT_EDITOR::finishItem()
         auto zone = static_cast<ZONE_CONTAINER*>( item );
 
         if( zone->IsFilled() && m_refill )
-        {
-            ZONE_FILLER filler( board() );
-            // A progress reporter can be usefull. However it works fine only on Windows
-            // so enable it only on Windows.
-            // On Linux, the filled areas are incorrectly shown: the insulated islands
-            // remain displayed, although they are removed from the actual filled areas list
-            //
-            // Fix me: try to make it working on Linux.
-            //
-            #ifdef __WINDOWS__
-            WX_PROGRESS_REPORTER reporter( getEditFrame<PCB_BASE_FRAME>(), _( "Refill Zones" ), 4 );
-            filler.SetProgressReporter( &reporter );
-            #endif
-            filler.Fill( { zone } );
-        }
+            m_toolMgr->RunAction( PCB_ACTIONS::zoneFill, true, zone );
     }
 }
 
diff --git a/pcbnew/tools/zone_filler_tool.cpp b/pcbnew/tools/zone_filler_tool.cpp
index ea208606e..9331bfeba 100644
--- a/pcbnew/tools/zone_filler_tool.cpp
+++ b/pcbnew/tools/zone_filler_tool.cpp
@@ -84,13 +84,18 @@ int ZONE_FILLER_TOOL::ZoneFill( const TOOL_EVENT& aEvent )
 
     BOARD_COMMIT commit( this );
 
-    for( auto item : selection() )
+    if( auto passedZone = aEvent.Parameter<ZONE_CONTAINER*>() )
     {
-        assert( item->Type() == PCB_ZONE_AREA_T );
-
-        ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*> ( item );
-
-        toFill.push_back(zone);
+        if( passedZone->Type() == PCB_ZONE_AREA_T )
+            toFill.push_back( passedZone );
+    }
+    else
+    {
+        for( auto item : selection() )
+        {
+            if( auto zone = dyn_cast<ZONE_CONTAINER*>( item ) )
+                toFill.push_back( zone );
+        }
     }
 
     std::unique_ptr<WX_PROGRESS_REPORTER> progressReporter(
-- 
2.20.1


Follow ups

References