eeschema hierarchical sheet copy-paste looses child sheet content

Bug #1830633 reported by Dino Ghilardi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Committed
High
Jeff Young

Bug Description

Using copy-paste on a child sheet block to have two sheets coming from the same file creates an empty sheet, possibly loosing data.

To reproduce the bug:

1 Create a project
2 Create a new hierarchical sheet (using "Add a hierarchical sheet").
2.5 Put something inside it (components, connections, etc.)
3 Go back to the parent sheet.
4 use copy-paste to create a new hierarchical sheet. It has the same file reference (correct)
5 if you enter the new created sheet it is empty (not correct, it should be the same as the copied sheet).
  if you save the schematic now you loose the old child sheet content. It seems it is overwritten by the new empty one having the same filename.

6: Workaround: If you edit the properties of the new block in the parent sheet (shortcut E or right-click->properties), do not change anything and confirm: a dialog asks for confirm, then the child sheet loads the correct schematic in it.

Quicker (more dangerous) way to reproduce the bug:
-Open a schematic (that has a backup somewhere) with some hierarchical sub-sheet
-copy-paste one of them
-save-->...data lost.

----------------------------------------------
Tested on revision db90e97d0beaeeb5f04b4e407d78108a897f1133
----------------------------------------------
Application: Eeschema
Version: (5.1.0-746-gdb90e97d0), debug build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.52.1 OpenSSL/1.0.2r zlib/1.2.8 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) libssh2/1.7.0 nghttp2/1.18.1 librtmp/2.3
Platform: Linux 4.9.0-8-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.8.0
    Curl: 7.52.1
    Compiler: GCC 6.3.0 with C++ ABI 1010

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

Tags: eeschema
summary: - eeschema hierarchical sheet copy-paste
+ eeschema hierarchical sheet copy-paste looses sheet content
description: updated
summary: - eeschema hierarchical sheet copy-paste looses sheet content
+ eeschema hierarchical sheet copy-paste looses child sheet content
Changed in kicad:
milestone: none → 6.0.0-rc1
Changed in kicad:
importance: Undecided → High
status: New → Triaged
Jeff Young (jeyjey)
Changed in kicad:
assignee: nobody → Jeff Young (jeyjey)
status: Triaged → In Progress
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision c7fa5c567fd9388f019800f49b968073e2523858
https://git.launchpad.net/kicad/patch/?id=c7fa5c567fd9388f019800f49b968073e2523858

Changed in kicad:
status: In Progress → Fix Committed
Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

Hello, there still a point that needs to be fixed (it is still possible to loose data in this way):

If you creatc the second child sheet with copy/paste before the first sheet has been saved you get a
"Error occurred opening schematic file..."
"Unable to open filename "....

then clicking OK you can place the "empty copy"
If you save now you get the old behaviour loosing data from the first and second child sheet.

workaround: save the schematic before pasting the file.

To reproduce the bug:
Create a new child sheet, DON't SAVE now.
put something on it, Don't save.
go up one level and create a new child sheet copying the old one, now:
-you get an error (the child sheet file is not found since it has not been saved)
-click OK
Place the new sheet. Since the file has not been loaded it is empty.
Save now and you loose the content of the child sheet (old and new).

Tested on revision cb83f8acdfdfc1f7659e7e87d2e0696520150bc9.

----------------------------------------------------------------------------
Application: Eeschema
Version: (5.1.0-843-gcb83f8acd), release build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.52.1 OpenSSL/1.0.2r zlib/1.2.8 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) libssh2/1.7.0 nghttp2/1.18.1 librtmp/2.3
Platform: Linux 4.9.0-8-amd64 x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.62.0
    OpenCASCADE Community Edition: 6.8.0
    Curl: 7.52.1
    Compiler: GCC 6.3.0 with C++ ABI 1010

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

Changed in kicad:
status: Fix Committed → In Progress
Revision history for this message
Jeff Young (jeyjey) wrote :

New sheet doesn't need to newly-created: if it's edited (but not yet saved) the pasted copy won't have the edits either. Basically we need to link to an existing sheet (if it already appears in the hierarchy).

Revision history for this message
Jeff Young (jeyjey) wrote :

Janitor asleep again, or did I forget the "fixes" line?

Changed in kicad:
status: In Progress → Fix Committed
Revision history for this message
Jeff Young (jeyjey) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.