kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #17114
[PATCH] Fix wxGTK assert in Layer Setup dialog
Hi all,
When I open the Design Rules -> Layer Setup dialog in PcbNew, I get an
assert from wxWidgets:
/src/gtk/scrolwin.cpp(205): assert "scrolled" failed in DoShowScrollbars():
window must be created
This is using the wxGTK backend on Arch. Tracking back through the code,
this is because a wxScrolledWindow is being created with the
wxALWAYS_SHOW_SB flag. The DoShowScrollbars() is called by the constructor
due to this flag, but this call is before a window exists to put the
scrollbars in.
I'm assuming this behaviour changed in wxWidgets 2.9.5 because
common/draw_panel.cpp has a conditionally compiled workaround.
The attached patch removes the wxALWAYS_SHOW_SB flag from the base fbp and
cpp files, and replaces it with a call to ShowScrollbars() in the inherited
dialog class; this now occurs after the window has been created. I have
also removed the conditional compilation check from common/draw_panel.cpp
since that was checking for wxWidgets >= 2.9.5., and 3.0 or later is now
enforced by CMake.
Using grep, I cannot find wxALWAYS_SHOW_SB being used with any other
wxScrolledWindows; the other instances are with text or list controls and I
haven't been able to trigger an assert from them.
Cheers,
Blair
=== modified file 'common/draw_panel.cpp'
--- common/draw_panel.cpp 2015-02-18 19:27:00 +0000
+++ common/draw_panel.cpp 2015-02-26 02:20:55 +0000
@@ -3,7 +3,7 @@
*
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@xxxxxxxxxxxxxxxxx
* Copyright (C) 2007-2011 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>
- * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -87,18 +87,12 @@
EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
const wxPoint& pos, const wxSize& size ) :
-#if wxCHECK_VERSION( 2, 9, 5 )
wxScrolledWindow( parent, id, pos, size, wxBORDER | wxHSCROLL | wxVSCROLL )
-#else
- wxScrolledWindow( parent, id, pos, size, wxBORDER | wxHSCROLL | wxVSCROLL | wxALWAYS_SHOW_SB )
-#endif
{
wxASSERT( parent );
-#if wxCHECK_VERSION( 2, 9, 5 )
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
DisableKeyboardScrolling();
-#endif
m_scrollIncrementX = std::min( size.x / 8, 10 );
m_scrollIncrementY = std::min( size.y / 8, 10 );
=== modified file 'pcbnew/dialogs/dialog_layers_setup.cpp'
--- pcbnew/dialogs/dialog_layers_setup.cpp 2014-09-14 15:34:37 +0000
+++ pcbnew/dialogs/dialog_layers_setup.cpp 2015-02-26 01:59:45 +0000
@@ -3,7 +3,7 @@
*
* Copyright (C) 2009 Isaac Marino Bavaresco, isaacbavaresco@xxxxxxxxxxxx
* Copyright (C) 2009 SoftPLC Corporation, Dick Hollenbeck <dick@xxxxxxxxxxx>
- * Copyright (C) 2009 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2009 - 2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -357,6 +357,8 @@
// plus 10 so we can have a border of 5 on both top and bottom.
m_TitlePanel->SetMinSize( wxSize( -1, m_AdhesFrontName->GetSize().y+10 ) );
+ m_LayersListPanel->ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
+
Layout();
Fit();
=== modified file 'pcbnew/dialogs/dialog_layers_setup_base.cpp'
--- pcbnew/dialogs/dialog_layers_setup_base.cpp 2014-09-14 15:34:37 +0000
+++ pcbnew/dialogs/dialog_layers_setup_base.cpp 2015-02-16 02:26:48 +0000
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Nov 6 2013)
+// C++ code generated with wxFormBuilder (version Nov 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -73,7 +73,7 @@
b_layersListSizer->Add( bCaptionsSizer, 0, wxALIGN_CENTER|wxEXPAND|wxRIGHT|wxLEFT, 5 );
- m_LayersListPanel = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxALWAYS_SHOW_SB|wxRAISED_BORDER|wxTAB_TRAVERSAL|wxVSCROLL );
+ m_LayersListPanel = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxRAISED_BORDER|wxTAB_TRAVERSAL|wxVSCROLL );
m_LayersListPanel->SetScrollRate( 0, 5 );
m_LayerListFlexGridSizer = new wxFlexGridSizer( 0, 3, 0, 0 );
m_LayerListFlexGridSizer->AddGrowableCol( 0 );
=== modified file 'pcbnew/dialogs/dialog_layers_setup_base.fbp'
--- pcbnew/dialogs/dialog_layers_setup_base.fbp 2014-09-14 15:34:37 +0000
+++ pcbnew/dialogs/dialog_layers_setup_base.fbp 2015-02-16 02:26:54 +0000
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
- <FileVersion major="1" minor="11" />
+ <FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@@ -707,7 +707,7 @@
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
- <property name="window_style">wxALWAYS_SHOW_SB|wxRAISED_BORDER|wxTAB_TRAVERSAL|wxVSCROLL</property>
+ <property name="window_style">wxRAISED_BORDER|wxTAB_TRAVERSAL|wxVSCROLL</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
=== modified file 'pcbnew/dialogs/dialog_layers_setup_base.h'
--- pcbnew/dialogs/dialog_layers_setup_base.h 2014-09-14 15:34:37 +0000
+++ pcbnew/dialogs/dialog_layers_setup_base.h 2015-02-16 02:26:58 +0000
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Nov 6 2013)
+// C++ code generated with wxFormBuilder (version Nov 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
Follow ups