Skip to content

Track restored to large size when saved after switching instruments in instrument window #3721

@michaelgregorius

Description

@michaelgregorius

Steps to reproduce:

  1. Start LMMS with the default project (with at least one Triple Oscillator).
  2. Add another Triple Oscillator (or another instrument).
  3. Open the instrument window of one of the instruments.
  4. Switch between instruments using the left / right arrow on the top of the instrument window.
  5. Save.
  6. Load the file that you have just saved.

The last selected instrument will be restored with a very large height that coincides with the instrument window's height.

The main cause is that there are two methods which store different types of heights as the attribute height in the node track under the parent trackcontainer:

  1. The method Track::saveSettings stores the height of the track under that node.
  2. The method InstrumentTrackWindow::saveSettings stores the window geometry of the instrument window by delegating to MainWindow::saveWidgetState. This step stores the height of the instrument window into the aforementioned node which causes the faulty restoring of the track height.

The switching of the instrument windows is relevant for this bug because at one point this action calls InstrumentTrackView::getInstrumentTrackWindow which installs a hook for the serialization so that InstrumentTrackWindow::saveSettings is called as well. Without this action no hook is installed and everything is fine. You can see this if you add a break point to SerializingObject::setHook and then execute the steps described above.

So everything action that leads to the installation of the aforementioned hook or a direct call to InstrumentTrackWindow::saveSettings will likely trigger this bug.

See the closed pull request #3692 for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions