Eeschema, SCH_PIN: fix incorrect initialization of m_layer member (now is LAYER_PIN)

m_layer was not re-initialized in CTOR, so it was the default value (LAYER_WIRE)
This is incorrect for a pin, and can create errors in some functions (like IsType() )
Fixes #1818
https://gitlab.com/kicad/code/kicad/issues/1818
This commit is contained in:
jean-pierre charras 2022-06-17 11:01:49 +02:00
parent 69f25f35a8
commit 50b68df666
1 changed files with 4 additions and 1 deletions

View File

@ -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) 2018 CERN * Copyright (C) 2018 CERN
* Copyright (C) 2019-2021 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com> * @author Jon Evans <jon@craftyjon.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -31,6 +31,7 @@
SCH_PIN::SCH_PIN( LIB_PIN* aLibPin, SCH_SYMBOL* aParentSymbol ) : SCH_PIN::SCH_PIN( LIB_PIN* aLibPin, SCH_SYMBOL* aParentSymbol ) :
SCH_ITEM( aParentSymbol, SCH_PIN_T ) SCH_ITEM( aParentSymbol, SCH_PIN_T )
{ {
m_layer = LAYER_PIN;
m_alt = wxEmptyString; m_alt = wxEmptyString;
m_number = aLibPin->GetNumber(); m_number = aLibPin->GetNumber();
m_libPin = aLibPin; m_libPin = aLibPin;
@ -46,6 +47,7 @@ SCH_PIN::SCH_PIN( LIB_PIN* aLibPin, SCH_SYMBOL* aParentSymbol ) :
SCH_PIN::SCH_PIN( SCH_SYMBOL* aParentSymbol, const wxString& aNumber, const wxString& aAlt ) : SCH_PIN::SCH_PIN( SCH_SYMBOL* aParentSymbol, const wxString& aNumber, const wxString& aAlt ) :
SCH_ITEM( aParentSymbol, SCH_PIN_T ) SCH_ITEM( aParentSymbol, SCH_PIN_T )
{ {
m_layer = LAYER_PIN;
m_alt = aAlt; m_alt = aAlt;
m_number = aNumber; m_number = aNumber;
m_libPin = nullptr; m_libPin = nullptr;
@ -56,6 +58,7 @@ SCH_PIN::SCH_PIN( SCH_SYMBOL* aParentSymbol, const wxString& aNumber, const wxSt
SCH_PIN::SCH_PIN( const SCH_PIN& aPin ) : SCH_PIN::SCH_PIN( const SCH_PIN& aPin ) :
SCH_ITEM( aPin ) SCH_ITEM( aPin )
{ {
m_layer = aPin.m_layer;
m_alt = aPin.m_alt; m_alt = aPin.m_alt;
m_number = aPin.m_number; m_number = aPin.m_number;
m_libPin = aPin.m_libPin; m_libPin = aPin.m_libPin;