Assertion failure quitting gerbview

Bug #1744600 reported by Jeff Young
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
High
Jon Evans

Bug Description

Open a gerber.
Click to select a pad.
Close document.
Assertion failure.

Is there any reason we allow selection in gerbveiw? It doesn't seem to have a purpose....

Assertion failed: (IsMapped()), function Allocate, file /Users/jeff/kicad_dev/kicad/common/gal/opengl/cached_container.cpp, line 108.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff694dee3e __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff6961d150 pthread_kill + 333
2 libsystem_c.dylib 0x00007fff6943b312 abort + 127
3 libsystem_c.dylib 0x00007fff69403368 __assert_rtn + 320
4 _gerbview.kiface 0x0000000109299acd KIGFX::CACHED_CONTAINER::Allocate(unsigned int) + 141 (cached_container.cpp:108)
5 _gerbview.kiface 0x00000001092a8084 KIGFX::VERTEX_MANAGER::Reserve(unsigned int) + 148 (vertex_manager.cpp:71)
6 _gerbview.kiface 0x00000001092690bf KIGFX::OPENGL_GAL::DrawCircle(VECTOR2<double> const&, double) + 63 (opengl_gal.cpp:471)
7 _gerbview.kiface 0x0000000108fb74b2 KIGFX::GERBVIEW_PAINTER::drawFlashedShape(GERBER_DRAW_ITEM*, bool) + 546 (gerbview_painter.cpp:431)
8 _gerbview.kiface 0x0000000108fb6c9c KIGFX::GERBVIEW_PAINTER::draw(GERBER_DRAW_ITEM*, int) + 3708 (gerbview_painter.cpp:332)
9 _gerbview.kiface 0x0000000108fb5df3 KIGFX::GERBVIEW_PAINTER::Draw(KIGFX::VIEW_ITEM const*, int) + 83 (gerbview_painter.cpp:160)
10 _gerbview.kiface 0x00000001091241ca KIGFX::VIEW::updateItemGeometry(KIGFX::VIEW_ITEM*, int) + 554 (view.cpp:1169)
11 _gerbview.kiface 0x0000000109123b20 KIGFX::VIEW::invalidateItem(KIGFX::VIEW_ITEM*, int) + 336 (view.cpp:1099)
12 _gerbview.kiface 0x00000001091250b7 KIGFX::VIEW::UpdateItems() + 503 (view.cpp:1286)
13 _gerbview.kiface 0x0000000109234c89 EDA_DRAW_PANEL_GAL::onPaint(wxPaintEvent&) + 297 (draw_panel_gal.cpp:168)
14 libwx_baseu-3.0.0.4.0.dylib 0x000000010350fd96 wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const + 134 (appbase.cpp:612)
15 libwx_baseu-3.0.0.4.0.dylib 0x000000010350fe35 wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const + 149 (appbase.cpp:623)
16 libwx_baseu-3.0.0.4.0.dylib 0x00000001037361fc wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) + 220 (event.cpp:1396)
17 libwx_baseu-3.0.0.4.0.dylib 0x000000010373875f wxEvtHandler::SearchDynamicEventTable(wxEvent&) + 335 (event.cpp:1754)
18 libwx_baseu-3.0.0.4.0.dylib 0x000000010373853d wxEvtHandler::TryHereOnly(wxEvent&) + 77 (event.cpp:1588)
19 libwx_baseu-3.0.0.4.0.dylib 0x00000001037382ad wxEvtHandler::TryBeforeAndHere(wxEvent&) + 77 (event.h:3680)
20 libwx_baseu-3.0.0.4.0.dylib 0x00000001037382ef wxEvtHandler::ProcessEventLocally(wxEvent&) + 47 (event.cpp:1525)
21 libwx_baseu-3.0.0.4.0.dylib 0x000000010373818e wxEvtHandler::ProcessEvent(wxEvent&) + 318 (event.cpp:1498)
22 libwx_baseu-3.0.0.4.0.dylib 0x0000000103737c81 wxEvtHandler::ProcessPendingEvents() + 1377 (event.cpp:1362)
23 libwx_baseu-3.0.0.4.0.dylib 0x000000010350f21c wxAppConsoleBase::ProcessPendingEvents() + 316 (appbase.cpp:522)
24 _gerbview.kiface 0x0000000109176103 TOOL_MANAGER::ProcessEvent(TOOL_EVENT const&) + 307 (tool_manager.cpp:755)
25 _gerbview.kiface 0x0000000108fbbedf GERBVIEW_SELECTION_TOOL::clearSelection() + 495 (selection_tool.cpp:617)
26 _gerbview.kiface 0x0000000108fbc3a9 GERBVIEW_SELECTION_TOOL::Main(TOOL_EVENT const&) + 1209 (selection_tool.cpp:241)

Application: kicad
Version: (2018-01-21 revision ba1fe4517)-master, debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0
Platform: Mac OS X (Darwin 17.3.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (UTF-8,STL containers,compatible with 2.8)
    Boost: 1.65.1
    Curl: 7.57.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

Build settings:
    USE_WX_GRAPHICS_CONTEXT=ON
    USE_WX_OVERLAY=ON
    KICAD_SCRIPTING=OFF
    KICAD_SCRIPTING_MODULES=OFF
    KICAD_SCRIPTING_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=OFF
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=OFF
    KICAD_SPICE=OFF

Revision history for this message
Jon Evans (craftyjon) wrote :

Can't reproduce on Linux. Does it happen on every file you open? Selection is used so that you can inspect which d-code is generating the graphic you have selected (see the message panel)

Changed in kicad:
importance: Undecided → High
Revision history for this message
Jeff Young (jeyjey) wrote :

Yeah, all files for me. GAL only. It's fine in Legacy. Note that it takes a while to crash after closing the file.

I've attached a really simple test file.

BTW, do you also get a Clarify Selection menu with two identical items in it when you select Gerber items?

description: updated
Revision history for this message
Jon Evans (craftyjon) wrote :

How are you closing the file? Just hitting the "clear" button?
I do not see multiple selection candidates in your test file.
I have tried your reproduction steps and haven't seen an assert yet.
Do you see it by literally letting gerbview sit running without any input after hitting clear?
Or are you doing other things (moving mouse around etc) that would give it events to process?

Revision history for this message
Jon Evans (craftyjon) wrote :

OK, I've found one way to trigger an assert, although the backtrace is different from yours.

Changed in kicad:
status: New → Confirmed
assignee: nobody → Jon Evans (craftyjon)
Revision history for this message
Jon Evans (craftyjon) wrote :

The attached patch fixes the issue I found, hopefully it is the same as what you are seeing even though I couldn't quite reproduce the same way you said

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 5ea277d229301342c27f7029b3ba4a2a693a749e
https://git.launchpad.net/kicad/patch/?id=5ea277d229301342c27f7029b3ba4a2a693a749e

Changed in kicad:
status: Confirmed → Fix Committed
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Thank you Jon, I have managed to reproduce the issue as well and I think this is the right fix. Thank you for the patch!

Revision history for this message
Jeff Young (jeyjey) wrote :

Doesn't fix it on OSX. I hooked up the debugger and the app goes down before the code in the patch gets executed.

To answer the earlier questions, I'm just hitting the window close button and then waiting. No mouse clicking or anything. (It's handling a paint event when it goes down.)

I'll debug a bit more....

Revision history for this message
Jeff Young (jeyjey) wrote :

Another interesting bit of info: if I run gerbview *and then* load a gerber, I don't get the double-items. If I double-click on a gerber in the project tree, then I do get double-items.

(Doesn't seem to affect the crash either way.)

Revision history for this message
Jeff Young (jeyjey) wrote :

Moving:
    if( m_toolManager )
        m_toolManager->DeactivateTool();

from:
    GERBVIEW_FRAME::~GERBVIEW_FRAME()

to:
    GERBVIEW_FRAME::OnCloseWindow()

fixes the OSX crash.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

The attached patch could be better:
It moves m_toolManager->DeactivateTool(); to OnCloseWindow and deactivates GAL events.
(We already have an issue with events fired after a frame was close)

Revision history for this message
Jeff Young (jeyjey) wrote : Re: [Bug 1744600] Re: Assertion failure quitting gerbview
Download full text (5.3 KiB)

There’s a compile error in it (canvas vs. GetGalCanvas()), but once that is corrected it does fix the bug on OSX.

> On 22 Jan 2018, at 17:10, jean-pierre charras <email address hidden> wrote:
>
> The attached patch could be better:
> It moves m_toolManager->DeactivateTool(); to OnCloseWindow and deactivates GAL events.
> (We already have an issue with events fired after a frame was close)
>
> ** Patch added: "gerbview_fix.patch"
> https://bugs.launchpad.net/kicad/+bug/1744600/+attachment/5041143/+files/gerbview_fix.patch
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1744600
>
> Title:
> Assertion failure quitting gerbview
>
> Status in KiCad:
> Fix Committed
>
> Bug description:
> Open a gerber.
> Click to select a pad.
> Close document.
> Assertion failure.
>
> Is there any reason we allow selection in gerbveiw? It doesn't seem
> to have a purpose....
>
> Assertion failed: (IsMapped()), function Allocate, file
> /Users/jeff/kicad_dev/kicad/common/gal/opengl/cached_container.cpp,
> line 108.
>
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0 libsystem_kernel.dylib 0x00007fff694dee3e __pthread_kill + 10
> 1 libsystem_pthread.dylib 0x00007fff6961d150 pthread_kill + 333
> 2 libsystem_c.dylib 0x00007fff6943b312 abort + 127
> 3 libsystem_c.dylib 0x00007fff69403368 __assert_rtn + 320
> 4 _gerbview.kiface 0x0000000109299acd KIGFX::CACHED_CONTAINER::Allocate(unsigned int) + 141 (cached_container.cpp:108)
> 5 _gerbview.kiface 0x00000001092a8084 KIGFX::VERTEX_MANAGER::Reserve(unsigned int) + 148 (vertex_manager.cpp:71)
> 6 _gerbview.kiface 0x00000001092690bf KIGFX::OPENGL_GAL::DrawCircle(VECTOR2<double> const&, double) + 63 (opengl_gal.cpp:471)
> 7 _gerbview.kiface 0x0000000108fb74b2 KIGFX::GERBVIEW_PAINTER::drawFlashedShape(GERBER_DRAW_ITEM*, bool) + 546 (gerbview_painter.cpp:431)
> 8 _gerbview.kiface 0x0000000108fb6c9c KIGFX::GERBVIEW_PAINTER::draw(GERBER_DRAW_ITEM*, int) + 3708 (gerbview_painter.cpp:332)
> 9 _gerbview.kiface 0x0000000108fb5df3 KIGFX::GERBVIEW_PAINTER::Draw(KIGFX::VIEW_ITEM const*, int) + 83 (gerbview_painter.cpp:160)
> 10 _gerbview.kiface 0x00000001091241ca KIGFX::VIEW::updateItemGeometry(KIGFX::VIEW_ITEM*, int) + 554 (view.cpp:1169)
> 11 _gerbview.kiface 0x0000000109123b20 KIGFX::VIEW::invalidateItem(KIGFX::VIEW_ITEM*, int) + 336 (view.cpp:1099)
> 12 _gerbview.kiface 0x00000001091250b7 KIGFX::VIEW::UpdateItems() + 503 (view.cpp:1286)
> 13 _gerbview.kiface 0x0000000109234c89 EDA_DRAW_PANEL_GAL::onPaint(wxPaintEvent&) + 297 (draw_panel_gal.cpp:168)
> 14 libwx_baseu-3.0.0.4.0.dylib 0x000000010350fd96 wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const + 134 (appbase.cpp:612)
> 15 libwx_baseu-3.0.0.4.0.dylib 0x000000010350fe35 wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const + 149 (appbase.cpp:623)
> 16 libwx_...

Read more...

Jeff Young (jeyjey)
Changed in kicad:
status: Fix Committed → New
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 61193dcd13df65638ae690874ec1961d813de025
https://git.launchpad.net/kicad/patch/?id=61193dcd13df65638ae690874ec1961d813de025

Changed in kicad:
status: New → Fix Committed
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.