Symbol Editor - Editing the name of an open symbol causes segfault

Description

When editing a symbol, changing the symbol name causes a segfault.

Obvious workaround is to just make a copy of the symbol with the correct name.

Steps to reproduce

  1. Open a symbol in the symbol editor.
  2. Edit the symbol name.
  3. Change the symbol and hit "Ok"
  4. This seems to cause a segfault

Video Example

I do have a core dump saved, but I can't attach it here.

KiCad Version

Application: KiCad
Version: 5.1.5, release build
Libraries:
    wxWidgets 3.0.5
    libcurl/7.70.0 OpenSSL/1.1.1g zlib/1.2.11 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh2/1.9.0 nghttp2/1.40.0
Platform: Linux 5.6.11-1-MANJARO x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
    Boost: 1.72.0
    OpenCASCADE Technology: 7.4.0
    Curl: 7.69.1
    Compiler: GCC 9.3.0 with C++ ABI 1013

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