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 memory leaks #6879

Merged
merged 40 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cabb9f3
Replace knobFModel with std::vector
sakertooth Sep 20, 2023
cb44295
Create QPixmap's on the stack
sakertooth Sep 20, 2023
35b728b
Assign parent for QGraphicsScene
sakertooth Sep 21, 2023
c52553b
Do not allocate QList on the heap
sakertooth Sep 21, 2023
96745ef
Use static QPixmap's
sakertooth Sep 21, 2023
df8d261
Clear m_vi2->knobFModel in destructor
sakertooth Sep 21, 2023
ab1c7f4
Use local static QPixmap's
sakertooth Sep 22, 2023
7ea957d
Do not allocate QPixmap with new in AudioFileProcessor
sakertooth Sep 22, 2023
4ac9170
Do not allocate QPixmap with new in Nes
sakertooth Sep 22, 2023
95f3566
Do not allocate QPixmap with new in Organic
sakertooth Sep 22, 2023
3c6b8c0
Do not allocate QPixmap with new in SaControlsDialog
sakertooth Sep 22, 2023
9e830c3
Do not allocate QPixmap with new in Vestige
sakertooth Sep 22, 2023
50e5707
Do not allocate QPixmap with new for FileBrowser
sakertooth Sep 22, 2023
fb055c2
Do not allocate QPixmap with new in MixerLine
sakertooth Sep 22, 2023
f539b6a
Do not allocate QPixmap with new in SendButtonIndicator
sakertooth Sep 22, 2023
d11ad5d
Do not allocate QPixmap with new in AutomationClipView
sakertooth Sep 22, 2023
155757f
Do not allocate QPixmap with new in MidiClipView
sakertooth Sep 22, 2023
65689f5
Do not allocate QPixmap with new in AutomationEditor
sakertooth Sep 22, 2023
8382629
Do not allocate QPixmap with new in PianoRoll
sakertooth Sep 22, 2023
55bc30e
Do not allocate QPixmap with new in TimeLineWidget
sakertooth Sep 22, 2023
405bec7
Do not allocate QPixmap with new in EnvelopeAndLfoView
sakertooth Sep 22, 2023
1ee56a6
Do not allocate QPixmap with new in PianoView
sakertooth Sep 22, 2023
54b7867
Do not allocate QPixmap with new in ComboBox
sakertooth Sep 22, 2023
bec3f7a
Do not allocate QPixmap with new in Fader
sakertooth Sep 22, 2023
7100051
Do not allocate QPixmap with new for LcdWidget
sakertooth Sep 22, 2023
27ada30
Do not allocate QPixmap with new for LedCheckbox
sakertooth Sep 22, 2023
4be08f2
Use m_ as prefix for members
sakertooth Sep 22, 2023
2e4f96f
Use uniform initialization
sakertooth Sep 22, 2023
b6e18b9
Merge remote-tracking branch 'upstream/master' into fix-memory-leaks
sakertooth Oct 21, 2023
e7de399
Uniform initiaization
sakertooth Oct 21, 2023
b4a67fa
And then he realized he was making copies...
sakertooth Oct 21, 2023
932ebe9
Do not call QPixmap copy constructor
sakertooth Oct 21, 2023
905bb64
Do not call QPixmap copy constructor in SaControlsDialog
sakertooth Oct 21, 2023
6852512
Do not make pixmap's static for Lcd's and Led's
sakertooth Nov 6, 2023
1389716
Initialize pixmaps in-class
sakertooth Nov 10, 2023
13f46da
Merge remote-tracking branch 'upstream/master' into fix-memory-leaks
sakertooth Nov 10, 2023
d4b106a
Fix few mistakes and formatting
sakertooth Nov 10, 2023
ddd869a
Merge remote-tracking branch 'upstream/master' into fix-memory-leaks
sakertooth Nov 11, 2023
76c8005
Merge remote-tracking branch 'upstream/master' into fix-memory-leaks
sakertooth Nov 19, 2023
5d20868
Merge remote-tracking branch 'upstream/master' into fix-memory-leaks
sakertooth Nov 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions include/AutomationClipView.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ protected slots:
QPixmap m_paintPixmap;

QStaticText m_staticTextName;

static QPixmap * s_clip_rec;

void scaleTimemapToFit( float oldMin, float oldMax );
} ;

Expand Down
14 changes: 7 additions & 7 deletions include/AutomationEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ protected slots:
AutomationEditor( const AutomationEditor & );
~AutomationEditor() override;

static QPixmap * s_toolDraw;
static QPixmap * s_toolErase;
static QPixmap * s_toolDrawOut;
static QPixmap * s_toolEditTangents;
static QPixmap * s_toolMove;
static QPixmap * s_toolYFlip;
static QPixmap * s_toolXFlip;
QPixmap* m_toolDraw;
QPixmap* m_toolErase;
QPixmap* m_toolDrawOut;
QPixmap* m_toolEditTangents;
QPixmap* m_toolMove;
QPixmap* m_toolYFlip;
QPixmap* m_toolXFlip;

ComboBoxModel m_zoomingXModel;
ComboBoxModel m_zoomingYModel;
Expand Down
6 changes: 3 additions & 3 deletions include/ComboBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public slots:


private:
static QPixmap* s_background;
static QPixmap* s_arrow;
static QPixmap* s_arrowSelected;
QPixmap* m_background;
QPixmap* m_arrow;
QPixmap* m_arrowSelected;

QMenu m_menu;

Expand Down
4 changes: 2 additions & 2 deletions include/EnvelopeAndLfoView.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ protected slots:


private:
static QPixmap * s_envGraph;
static QPixmap * s_lfoGraph;
QPixmap* m_envGraph;
QPixmap* m_lfoGraph;

EnvelopeAndLfoParameters * m_params;

Expand Down
4 changes: 0 additions & 4 deletions include/Fader.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ class LMMS_EXPORT Fader : public QWidget, public FloatModelView
QElapsedTimer m_lastPeakTimer_L;
QElapsedTimer m_lastPeakTimer_R;

static QPixmap * s_back;
static QPixmap * s_leds;
static QPixmap * s_knob;

QPixmap * m_back;
QPixmap * m_leds;
QPixmap * m_knob;
Expand Down
8 changes: 3 additions & 5 deletions include/FileBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,12 @@ class Directory : public QTreeWidgetItem


private:
void initPixmaps();

bool addItems( const QString & path );


static QPixmap * s_folderPixmap;
static QPixmap * s_folderOpenedPixmap;
static QPixmap * s_folderLockedPixmap;
QPixmap* m_folderPixmap;
QPixmap* m_folderOpenedPixmap;
QPixmap* m_folderLockedPixmap;

//! Directories that lead here
//! Initially, this is just set to the current path of a directory
Expand Down
4 changes: 2 additions & 2 deletions include/LedCheckBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class LMMS_EXPORT LedCheckBox : public AutomatableButton


private:
QPixmap * m_ledOnPixmap;
QPixmap * m_ledOffPixmap;
QPixmap* m_ledOnPixmap;
QPixmap* m_ledOffPixmap;

QString m_text;

Expand Down
2 changes: 0 additions & 2 deletions include/MixerLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ class MixerLine : public QWidget
QColor m_strokeOuterInactive;
QColor m_strokeInnerActive;
QColor m_strokeInnerInactive;
static QPixmap * s_sendBgArrow;
static QPixmap * s_receiveBgArrow;
bool m_inRename;
QLineEdit * m_renameLineEdit;
QGraphicsView * m_view;
Expand Down
12 changes: 6 additions & 6 deletions include/PianoRoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,12 @@ protected slots:
static const int cm_scrollAmtHoriz = 10;
static const int cm_scrollAmtVert = 1;

static QPixmap * s_toolDraw;
static QPixmap * s_toolErase;
static QPixmap * s_toolSelect;
static QPixmap * s_toolMove;
static QPixmap * s_toolOpen;
static QPixmap* s_toolKnife;
QPixmap* m_toolDraw;
QPixmap* m_toolErase;
QPixmap* m_toolSelect;
QPixmap* m_toolMove;
QPixmap* m_toolOpen;
QPixmap* m_toolKnife;

static std::array<KeyType, 12> prKeyOrder;

Expand Down
12 changes: 6 additions & 6 deletions include/PianoView.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ class PianoView : public QWidget, public ModelView
int getKeyHeight(int key_num) const;
IntModel *getNearestMarker(int key, QString* title = nullptr);

static QPixmap * s_whiteKeyPm;
static QPixmap * s_blackKeyPm;
static QPixmap * s_whiteKeyPressedPm;
static QPixmap * s_blackKeyPressedPm;
static QPixmap * s_whiteKeyDisabledPm;
static QPixmap * s_blackKeyDisabledPm;
QPixmap* m_whiteKeyPm;
QPixmap* m_blackKeyPm;
QPixmap* m_whiteKeyPressedPm;
QPixmap* m_blackKeyPressedPm;
QPixmap* m_whiteKeyDisabledPm;
QPixmap* m_blackKeyDisabledPm;

Piano * m_piano;

Expand Down
4 changes: 2 additions & 2 deletions include/SendButtonIndicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class SendButtonIndicator : public QLabel

MixerLine * m_parent;
MixerView * m_mv;
static QPixmap * s_qpmOn;
static QPixmap * s_qpmOff;
QPixmap* m_qpmOn;
QPixmap* m_qpmOff;

FloatModel * getSendModel();
};
Expand Down
2 changes: 1 addition & 1 deletion include/TimeLineWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public slots:


private:
static QPixmap * s_posMarkerPixmap;
QPixmap* m_posMarkerPixmap;

QColor m_inactiveLoopColor;
QBrush m_inactiveLoopBrush;
Expand Down
10 changes: 2 additions & 8 deletions plugins/AudioFileProcessor/AudioFileProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,19 +447,12 @@ namespace gui
{


QPixmap * AudioFileProcessorView::s_artwork = nullptr;


AudioFileProcessorView::AudioFileProcessorView( Instrument * _instrument,
QWidget * _parent ) :
InstrumentViewFixedSize( _instrument, _parent )
{
if( s_artwork == nullptr )
{
s_artwork = new QPixmap( PLUGIN_NAME::getIconPixmap(
"artwork" ) );
}

m_openAudioFileButton = new PixmapButton( this );
m_openAudioFileButton->setCursor( QCursor( Qt::PointingHandCursor ) );
m_openAudioFileButton->move( 227, 72 );
Expand Down Expand Up @@ -645,7 +638,8 @@ void AudioFileProcessorView::paintEvent( QPaintEvent * )
{
QPainter p( this );

p.drawPixmap( 0, 0, *s_artwork );
static auto s_artwork = PLUGIN_NAME::getIconPixmap("artwork");
p.drawPixmap(0, 0, s_artwork);

auto a = castModel<AudioFileProcessor>();

Expand Down
1 change: 0 additions & 1 deletion plugins/AudioFileProcessor/AudioFileProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ protected slots:
private:
virtual void modelChanged();

static QPixmap * s_artwork;

AudioFileProcessorWaveView * m_waveView;
Knob * m_ampKnob;
Expand Down
16 changes: 8 additions & 8 deletions plugins/Eq/EqControlsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) :
setBand( 6, &controls->m_highShelfActiveModel, &controls->m_highShelfFreqModel, &controls->m_highShelfResModel, &controls->m_highShelfGainModel, QColor(255 ,255, 255), tr( "High-shelf" ), &controls->m_highShelfPeakL, &controls->m_highShelfPeakR,0,0,0,0,0,0 );
setBand( 7, &controls->m_lpActiveModel, &controls->m_lpFreqModel, &controls->m_lpResModel, 0, QColor(255 ,255, 255), tr( "LP" ) ,0,0,0,0,0, &controls->m_lp12Model, &controls->m_lp24Model, &controls->m_lp48Model);

auto faderBg = new QPixmap(PLUGIN_NAME::getIconPixmap("faderback"));
auto faderLeds = new QPixmap(PLUGIN_NAME::getIconPixmap("faderleds"));
auto faderKnob = new QPixmap(PLUGIN_NAME::getIconPixmap("faderknob"));
static auto s_faderBg = PLUGIN_NAME::getIconPixmap("faderback");
static auto s_faderLeds = PLUGIN_NAME::getIconPixmap("faderleds");
static auto s_faderKnob = PLUGIN_NAME::getIconPixmap("faderknob");

auto GainFaderIn = new EqFader(&controls->m_inGainModel, tr("Input gain"), this, faderBg, faderLeds, faderKnob,
auto GainFaderIn = new EqFader(&controls->m_inGainModel, tr("Input gain"), this, &s_faderBg, &s_faderLeds, &s_faderKnob,
&controls->m_inPeakL, &controls->m_inPeakR);
GainFaderIn->move( 23, 295 );
GainFaderIn->setDisplayConversion( false );
GainFaderIn->setHintText( tr( "Gain" ), "dBv");

auto GainFaderOut = new EqFader(&controls->m_outGainModel, tr("Output gain"), this, faderBg, faderLeds, faderKnob,
auto GainFaderOut = new EqFader(&controls->m_outGainModel, tr("Output gain"), this, &s_faderBg, &s_faderLeds, &s_faderKnob,
&controls->m_outPeakL, &controls->m_outPeakR);
GainFaderOut->move( 453, 295);
GainFaderOut->setDisplayConversion( false );
Expand All @@ -92,8 +92,8 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) :
int distance = 126;
for( int i = 1; i < m_parameterWidget->bandCount() - 1; i++ )
{
auto gainFader = new EqFader(m_parameterWidget->getBandModels(i)->gain, tr(""), this, faderBg, faderLeds,
faderKnob, m_parameterWidget->getBandModels(i)->peakL, m_parameterWidget->getBandModels(i)->peakR);
auto gainFader = new EqFader(m_parameterWidget->getBandModels(i)->gain, tr(""), this, &s_faderBg, &s_faderLeds,
&s_faderKnob, m_parameterWidget->getBandModels(i)->peakL, m_parameterWidget->getBandModels(i)->peakR);
gainFader->move( distance, 295 );
distance += 44;
gainFader->setMinimumHeight(80);
Expand Down Expand Up @@ -242,4 +242,4 @@ EqBand* EqControlsDialog::setBand(int index, BoolModel* active, FloatModel* freq
}


} // namespace lmms::gui
} // namespace lmms::gui
Loading