Skip to content

Fix segfault when opening SF2 Player GUI during load #8227#8322

Open
BernardoMalheiro wants to merge 2 commits into
LMMS:masterfrom
BernardoMalheiro:fix-8227
Open

Fix segfault when opening SF2 Player GUI during load #8227#8322
BernardoMalheiro wants to merge 2 commits into
LMMS:masterfrom
BernardoMalheiro:fix-8227

Conversation

@BernardoMalheiro
Copy link
Copy Markdown

@BernardoMalheiro BernardoMalheiro commented Mar 23, 2026

Clicking the TrackLabelButton while a soundfont was still loading triggered InstrumentTrackWindow::adjustTabSize() with a null widget pointer, causing a segmentation fault.

Changes:

  1. Disable TrackLabelButton in constructor when no instrument is loaded
  2. Re-enable TrackLabelButton via onInstrumentChanged() slot connected to InstrumentTrack::instrumentChanged() signal
  3. Add null guard in adjustTabSize() as an additional safety measure

Closes #8227

Root cause:
- clicking the TrackLabelButton while a soundfont was still
loading triggered InstrumentTrackWindow::adjustTabSize()
with a null widget pointer, causing a segmentation fault
Changes:
- disable TrackLabelButton in constructor when no instrument
is loaded
- re-enable TrackLabelButton via onInstrumentChanged() slot
connected to InstrumentTrack::instrumentChanged() signal
- add null guard in adjustTabSize() as an additional
safety measure
Copy link
Copy Markdown
Contributor

@rubiefawn rubiefawn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't yet tested this fix. I'll update this comment when I do.

Comment thread include/InstrumentTrackView.h Outdated
Comment thread src/gui/instrument/InstrumentTrackWindow.cpp Outdated
Comment thread src/gui/tracks/InstrumentTrackView.cpp Outdated
Comment thread src/gui/tracks/InstrumentTrackView.cpp Outdated
Comment thread src/gui/tracks/InstrumentTrackView.cpp Outdated
@rubiefawn rubiefawn added bug needs testing This pull request needs more testing labels Mar 23, 2026
- Refine button state logic: Updated the implementation
to follow the specific architectural pattern suggested
during review.
- Code style adjustments: Cleaned up spacing to better match the
project's guidelines.
- Removed null checks that were identified as unnecessary
by the maintainers.
@BernardoMalheiro
Copy link
Copy Markdown
Author

Hi @rubiefawn! It's been about a month since I pushed the follow-up addressing your review. I removed the Doxygen comments, dropped the null guard, replaced the constructor logic with onInstrumentChanged(), and updated the connect() call to use the new Qt5 pointer-to-member syntax. Would you have time to take another look when you get a chance? Happy to make further adjustments if needed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug needs testing This pull request needs more testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segmentation fault when trying to open GUI before soundfont finishes loading

2 participants