Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix small memory leaks in EQ dialog #6300

Merged
merged 1 commit into from
Feb 11, 2022

Conversation

PhysSong
Copy link
Member

@PhysSong PhysSong commented Feb 6, 2022

Fixes #6026.

@LmmsBot
Copy link

LmmsBot commented Feb 6, 2022

🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩

Linux

Windows

macOS

🤖
{"platform_name_to_artifacts": {"Linux": [{"artifact": {"title": {"title": "(AppImage)", "platform_name": "Linux"}, "link": {"link": "https://1379-94782492-gh.circle-artifacts.com/0/lmms-1.2.3-919%2Bgd0e65134f-linux-x86_64.AppImage"}}, "build_link": "https://circleci.com/gh/PhysSong/lmms/1379?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}], "Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://1377-94782492-gh.circle-artifacts.com/0/lmms-1.2.3-919%2Bgd0e65134f-mingw-win32.exe"}}, "build_link": "https://circleci.com/gh/PhysSong/lmms/1377?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://1380-94782492-gh.circle-artifacts.com/0/lmms-1.2.3-919%2Bgd0e65134f-mingw-win64.exe"}}, "build_link": "https://circleci.com/gh/PhysSong/lmms/1380?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}, {"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/4yrji2hoifay968f/artifacts/build/lmms-1.3.0-alpha-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/42468559"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/b6ppg40bh9iscc91/artifacts/build/lmms-1.3.0-alpha-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/42468559"}], "macOS": [{"artifact": {"title": {"title": "", "platform_name": "macOS"}, "link": {"link": "https://1376-94782492-gh.circle-artifacts.com/0/lmms-1.2.3-919%2Bgd0e65134f-mac10.14.dmg"}}, "build_link": "https://circleci.com/gh/PhysSong/lmms/1376?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link"}]}, "commit_sha": "d0e65134f84ebdcf89fc5d23ff3b06394a24486e"}

@Spekular
Copy link
Member

Spekular commented Feb 8, 2022

Breaking this down for myself:

lpBtnGrp and hpBtnGrp are instances of automatableButtonGroup, which is defined in AutomatableButton. They inherit from IntModelView, which is a TypedModelView, which is an AutomatableModelView, which has the setModel method that then calls ModelView::setModel. The parameter being implicitly changed to true here is isOldModelValid, which allows us to enter this if statement:

if( isOldModelValid && m_model != nullptr )

Because automatableButtonGroup creates an IntModel with defaultConstructed set to true...

IntModelView( new IntModel( 0, 0, 0, nullptr, _name, true ), this )

IntModel( int val = 0, int min = 0, int max = 0,
Model* parent = nullptr,
const QString& displayName = QString(),
bool defaultConstructed = false ) :

... we enter the next if statement, where this useless default model is deleted

delete m_model;

Whew.

Copy link
Member

@Spekular Spekular left a comment

Choose a reason for hiding this comment

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

LGTM!

@PhysSong PhysSong merged commit 8a0f1dd into LMMS:master Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on exit from rpmalloc assert in debug builds, equalizer plugin related
3 participants