Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing icons for some instruments (LMMS#7132)
Revert some of the changes made in commit 88e0e94. The underlying idea was that the `InstrumentTrackView` should be responsible for assigning the icon that's shown by its `TrackLabelButton`. However, this does not work because in some cases the `InstrumentTrack` that's passed into `InstrumentTrackView::determinePixmap` does not have an `Instrument` assigned. This in turn seems to be caused due to initalizations that are running in parallel in different threads. Here are the steps to reproduce the threading problem (line numbers refer to commit 360254f): 1. Set a break point in line 1054 of `InstrumentTrack`, i.e. the line in `InstrumentTrack::loadInstrument` where `m_instrument` is being assigned to. 2. Set a break point in `InstrumentTrackView::determinePixmap`, e.g. inside of the first if statement. 3. Drop an instance of "Sf2 Player" onto the Song Editor. 4. The first break point in `InstrumentTrack` is hit in a thread called "lmms::Instrumen" (shown like that in my debugger). Try to step over it. 5. The second break point in `InstrumentTrackView` now gets hit before the code is stepped over. This time we are in the thread called "lmms". I guess this is the GUI main thread. 6. Continue execution. If you now switch to the application then the icon is shown. I guess the debugger is halted long enough in the main thread so that the InstrumentTrack gets an instrument assigned in another thread. If you delete/disable the break point in `InstrumentTrack::determinePixmap` and follow the coarse steps above then the icon is not shown because the track has no instrument. The current fix still delegates to the `InstrumentTrackView` to determine the pixmap in hopes that one day there will be a better solution where the parent component can be fully responsible for its child component. Fixes LMMS#7116.
- Loading branch information