fix if comparison with uninitialized member value
Fix the valgrind warning from the use of an uninitialized member variable by setting the DEFAULT value for m_currentNativeCursor in the constructors member initializer list. This fixes the following warning caused by the SetNativeCursorStyle method call later on the constructor. ==66660== Warning: client switching stacks? SP change: 0x1ffeffee40 --> 0xdf7efe8 ==66660== to suppress, use: --max-stackframe=137187819096 or greater ==66660== Conditional jump or move depends on uninitialised value(s) ==66660== at 0x13F0764E: UnknownInlinedFun (graphics_abstraction_layer.cpp:276) ==66660== by 0x13F0764E: KIGFX::GAL::GAL(KIGFX::GAL_DISPLAY_OPTIONS&) (graphics_abstraction_layer.cpp:78) Error can be reproduced and checked from the log.txt by launching kicad with valgrind command "valgrind --leak-check=full kicad > log.txt 2>&1" and then launching the footprint editor from the kicad main dialog. Fixes https://gitlab.com/kicad/code/kicad/-/issues/8784 Signed-off-by: Mika Laitio <lamikr@gmail.com>
This commit is contained in:
parent
1edba867b9
commit
1e21daf781
|
@ -38,7 +38,13 @@ using namespace KIGFX;
|
|||
|
||||
GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
|
||||
m_options( aDisplayOptions ),
|
||||
m_strokeFont( this )
|
||||
m_strokeFont( this ),
|
||||
// m_currentNativeCursor is initialized with KICURSOR::DEFAULT value to avoid
|
||||
// if comparison with uninitialized value on SetNativeCursorStyle method.
|
||||
// Some classes inheriting from GAL has different SetNativeCursorStyle method
|
||||
// implementation and therefore it's called also on constructor
|
||||
// to change the value from DEFAULT to KICURSOR::ARROW
|
||||
m_currentNativeCursor( KICURSOR::DEFAULT )
|
||||
{
|
||||
// Set the default values for the internal variables
|
||||
SetIsFill( false );
|
||||
|
|
Loading…
Reference in New Issue