Prevent crash when a python script tries to use pcbnew too early.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15414
This commit is contained in:
parent
16c35857bf
commit
b1b66f66f4
|
@ -108,6 +108,7 @@
|
||||||
#include <footprint_viewer_frame.h>
|
#include <footprint_viewer_frame.h>
|
||||||
|
|
||||||
#include <action_plugin.h>
|
#include <action_plugin.h>
|
||||||
|
#include <pcbnew_scripting_helpers.h>
|
||||||
#include "../scripting/python_scripting.h"
|
#include "../scripting/python_scripting.h"
|
||||||
|
|
||||||
#include <wx/filedlg.h>
|
#include <wx/filedlg.h>
|
||||||
|
@ -486,6 +487,8 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
|
PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
|
||||||
{
|
{
|
||||||
|
ScriptingOnDestructPcbEditFrame( this );
|
||||||
|
|
||||||
if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
|
if( ADVANCED_CFG::GetCfg().m_ShowEventCounters )
|
||||||
{
|
{
|
||||||
// Stop the timer during destruction early to avoid potential event race conditions (that
|
// Stop the timer during destruction early to avoid potential event race conditions (that
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
|
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
|
||||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -77,6 +77,13 @@ void ScriptingSetPcbEditFrame( PCB_EDIT_FRAME* aPcbEditFrame )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ScriptingOnDestructPcbEditFrame( PCB_EDIT_FRAME* aPcbEditFrame )
|
||||||
|
{
|
||||||
|
if( s_PcbEditFrame == aPcbEditFrame )
|
||||||
|
s_PcbEditFrame = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOARD* LoadBoard( wxString& aFileName )
|
BOARD* LoadBoard( wxString& aFileName )
|
||||||
{
|
{
|
||||||
if( aFileName.EndsWith( KiCadPcbFileExtension ) )
|
if( aFileName.EndsWith( KiCadPcbFileExtension ) )
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo <miguelangel@ajo.es>
|
* Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo <miguelangel@ajo.es>
|
||||||
* Copyright (C) 2013-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 2013-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -39,7 +39,8 @@ enum class EDA_UNITS;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
void ScriptingSetPcbEditFrame( PCB_EDIT_FRAME* aPCBEdaFrame );
|
void ScriptingSetPcbEditFrame( PCB_EDIT_FRAME* aPCBEdaFrame );
|
||||||
|
void ScriptingOnDestructPcbEditFrame( PCB_EDIT_FRAME* aPCBEdaFrame );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue