Fix memory leaks (#6879)
* Replace knobFModel with std::vector * Create QPixmap's on the stack * Assign parent for QGraphicsScene A call to QGraphicsView::setScene does not make the view take ownership of the scene. * Do not allocate QList on the heap * Use static QPixmap's The QPixmap's need to be created within the constructor, and not outside where they are defined, since it can't find them otherwise. I'm not too sure why. * Clear m_vi2->knobFModel in destructor * Use local static QPixmap's * Do not allocate QPixmap with new in AudioFileProcessor * Do not allocate QPixmap with new in Nes * Do not allocate QPixmap with new in Organic * Do not allocate QPixmap with new in SaControlsDialog * Do not allocate QPixmap with new in Vestige * Do not allocate QPixmap with new for FileBrowser * Do not allocate QPixmap with new in MixerLine * Do not allocate QPixmap with new in SendButtonIndicator * Do not allocate QPixmap with new in AutomationClipView * Do not allocate QPixmap with new in MidiClipView * Do not allocate QPixmap with new in AutomationEditor * Do not allocate QPixmap with new in PianoRoll * Do not allocate QPixmap with new in TimeLineWidget * Do not allocate QPixmap with new in EnvelopeAndLfoView * Do not allocate QPixmap with new in PianoView * Do not allocate QPixmap with new in ComboBox * Do not allocate QPixmap with new in Fader * Do not allocate QPixmap with new for LcdWidget * Do not allocate QPixmap with new for LedCheckbox * Use m_ as prefix for members * Use uniform initialization I already started using uniform initialization for the QPixmap changes for some reason, so I'm finishing that up. * Uniform initiaization * And then he realized he was making copies... * Do not call QPixmap copy constructor * Do not call QPixmap copy constructor in SaControlsDialog * Do not make pixmap's static for Lcd's and Led's * Initialize pixmaps in-class * Fix few mistakes and formatting
This commit is contained in:
@@ -74,9 +74,6 @@ private:
|
||||
QPixmap m_paintPixmap;
|
||||
|
||||
QStaticText m_staticTextName;
|
||||
|
||||
static QPixmap * s_clip_rec;
|
||||
|
||||
void scaleTimemapToFit( float oldMin, float oldMax );
|
||||
} ;
|
||||
|
||||
|
||||
@@ -187,13 +187,13 @@ private:
|
||||
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 = embed::getIconPixmap("edit_draw");
|
||||
QPixmap m_toolErase = embed::getIconPixmap("edit_erase");
|
||||
QPixmap m_toolDrawOut = embed::getIconPixmap("edit_draw_outvalue");
|
||||
QPixmap m_toolEditTangents = embed::getIconPixmap("edit_tangent");
|
||||
QPixmap m_toolMove = embed::getIconPixmap("edit_move");
|
||||
QPixmap m_toolYFlip = embed::getIconPixmap("flip_y");
|
||||
QPixmap m_toolXFlip = embed::getIconPixmap("flip_x");
|
||||
|
||||
ComboBoxModel m_zoomingXModel;
|
||||
ComboBoxModel m_zoomingYModel;
|
||||
|
||||
@@ -66,9 +66,9 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
static QPixmap* s_background;
|
||||
static QPixmap* s_arrow;
|
||||
static QPixmap* s_arrowSelected;
|
||||
QPixmap m_background = embed::getIconPixmap("combobox_bg");
|
||||
QPixmap m_arrow = embed::getIconPixmap("combobox_arrow");
|
||||
QPixmap m_arrowSelected = embed::getIconPixmap("combobox_arrow_selected");
|
||||
|
||||
QMenu m_menu;
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "ModelView.h"
|
||||
#include "embed.h"
|
||||
|
||||
class QPaintEvent;
|
||||
class QPixmap;
|
||||
@@ -71,8 +72,8 @@ protected slots:
|
||||
|
||||
|
||||
private:
|
||||
static QPixmap * s_envGraph;
|
||||
static QPixmap * s_lfoGraph;
|
||||
QPixmap m_envGraph = embed::getIconPixmap("envelope_graph");
|
||||
QPixmap m_lfoGraph = embed::getIconPixmap("lfo_graph");
|
||||
|
||||
EnvelopeAndLfoParameters * m_params;
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
|
||||
|
||||
#include "AutomatableModelView.h"
|
||||
#include "embed.h"
|
||||
|
||||
|
||||
namespace lmms::gui
|
||||
@@ -131,7 +132,7 @@ private:
|
||||
float fRange = model()->maxValue() - model()->minValue();
|
||||
float realVal = model()->value() - model()->minValue();
|
||||
|
||||
return height() - ( ( height() - m_knob->height() ) * ( realVal / fRange ) );
|
||||
return height() - ((height() - m_knob.height()) * (realVal / fRange));
|
||||
}
|
||||
|
||||
void setPeak( float fPeak, float &targetPeak, float &persistentPeak, QElapsedTimer &lastPeakTimer );
|
||||
@@ -151,13 +152,9 @@ private:
|
||||
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;
|
||||
QPixmap m_back = embed::getIconPixmap("fader_background");
|
||||
QPixmap m_leds = embed::getIconPixmap("fader_leds");
|
||||
QPixmap m_knob = embed::getIconPixmap("fader_knob");
|
||||
|
||||
bool m_levelsDisplayedInDBFS;
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <QCheckBox>
|
||||
#include <QDir>
|
||||
#include <QMutex>
|
||||
#include "embed.h"
|
||||
|
||||
#include "FileBrowserSearcher.h"
|
||||
#include <QProgressBar>
|
||||
@@ -221,14 +222,12 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
void initPixmaps();
|
||||
|
||||
bool addItems( const QString & path );
|
||||
|
||||
|
||||
static QPixmap * s_folderPixmap;
|
||||
static QPixmap * s_folderOpenedPixmap;
|
||||
static QPixmap * s_folderLockedPixmap;
|
||||
QPixmap m_folderPixmap = embed::getIconPixmap("folder");
|
||||
QPixmap m_folderOpenedPixmap = embed::getIconPixmap("folder_opened");
|
||||
QPixmap m_folderLockedPixmap = embed::getIconPixmap("folder_locked");
|
||||
|
||||
//! Directories that lead here
|
||||
//! Initially, this is just set to the current path of a directory
|
||||
@@ -305,14 +304,6 @@ private:
|
||||
void initPixmaps();
|
||||
void determineFileType();
|
||||
|
||||
static QPixmap * s_projectFilePixmap;
|
||||
static QPixmap * s_presetFilePixmap;
|
||||
static QPixmap * s_sampleFilePixmap;
|
||||
static QPixmap * s_soundfontFilePixmap;
|
||||
static QPixmap * s_vstPluginFilePixmap;
|
||||
static QPixmap * s_midiFilePixmap;
|
||||
static QPixmap * s_unknownFilePixmap;
|
||||
|
||||
QString m_path;
|
||||
FileType m_type;
|
||||
FileHandling m_handling;
|
||||
|
||||
@@ -47,8 +47,6 @@ public:
|
||||
LcdWidget(int numDigits, const QString& style, QWidget* parent, const QString& name = QString(),
|
||||
bool leadingZero = false);
|
||||
|
||||
~LcdWidget() override;
|
||||
|
||||
void setValue(int value);
|
||||
void setValue(float value);
|
||||
void setLabel(const QString& label);
|
||||
@@ -98,7 +96,7 @@ private:
|
||||
QString m_display;
|
||||
|
||||
QString m_label;
|
||||
QPixmap* m_lcdPixmap;
|
||||
QPixmap m_lcdPixmap;
|
||||
|
||||
QColor m_textColor;
|
||||
QColor m_textShadowColor;
|
||||
|
||||
@@ -54,9 +54,6 @@ public:
|
||||
LedColor _color = LedColor::Yellow,
|
||||
bool legacyMode = true);
|
||||
|
||||
~LedCheckBox() override;
|
||||
|
||||
|
||||
inline const QString & text()
|
||||
{
|
||||
return( m_text );
|
||||
@@ -71,8 +68,8 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
QPixmap * m_ledOnPixmap;
|
||||
QPixmap * m_ledOffPixmap;
|
||||
QPixmap m_ledOnPixmap;
|
||||
QPixmap m_ledOffPixmap;
|
||||
|
||||
QString m_text;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <QStaticText>
|
||||
#include "ClipView.h"
|
||||
#include "embed.h"
|
||||
|
||||
namespace lmms
|
||||
{
|
||||
@@ -85,10 +86,10 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
static QPixmap * s_stepBtnOn0;
|
||||
static QPixmap * s_stepBtnOn200;
|
||||
static QPixmap * s_stepBtnOff;
|
||||
static QPixmap * s_stepBtnOffLight;
|
||||
QPixmap m_stepBtnOn0 = embed::getIconPixmap("step_btn_on_0");
|
||||
QPixmap m_stepBtnOn200 = embed::getIconPixmap("step_btn_on_200");
|
||||
QPixmap m_stepBtnOff = embed::getIconPixmap("step_btn_off");
|
||||
QPixmap m_stepBtnOffLight = embed::getIconPixmap("step_btn_off_light");
|
||||
|
||||
MidiClip* m_clip;
|
||||
QPixmap m_paintPixmap;
|
||||
|
||||
@@ -94,8 +94,6 @@ private:
|
||||
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;
|
||||
|
||||
@@ -340,12 +340,12 @@ private:
|
||||
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 = embed::getIconPixmap("edit_draw");
|
||||
QPixmap m_toolErase = embed::getIconPixmap("edit_erase");
|
||||
QPixmap m_toolSelect = embed::getIconPixmap("edit_select");
|
||||
QPixmap m_toolMove = embed::getIconPixmap("edit_move");
|
||||
QPixmap m_toolOpen = embed::getIconPixmap("automation");
|
||||
QPixmap m_toolKnife = embed::getIconPixmap("edit_knife");
|
||||
|
||||
static std::array<KeyType, 12> prKeyOrder;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "AutomatableModel.h"
|
||||
#include "ModelView.h"
|
||||
#include "embed.h"
|
||||
|
||||
namespace lmms
|
||||
{
|
||||
@@ -73,12 +74,12 @@ private:
|
||||
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 = embed::getIconPixmap("white_key");
|
||||
QPixmap m_blackKeyPm = embed::getIconPixmap("black_key");
|
||||
QPixmap m_whiteKeyPressedPm = embed::getIconPixmap("white_key_pressed");
|
||||
QPixmap m_blackKeyPressedPm = embed::getIconPixmap("black_key_pressed");
|
||||
QPixmap m_whiteKeyDisabledPm = embed::getIconPixmap("white_key_disabled");
|
||||
QPixmap m_blackKeyDisabledPm = embed::getIconPixmap("black_key_disabled");
|
||||
|
||||
Piano * m_piano;
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define LMMS_GUI_SEND_BUTTON_INDICATOR_H
|
||||
|
||||
#include <QLabel>
|
||||
#include "embed.h"
|
||||
|
||||
|
||||
namespace lmms
|
||||
@@ -53,8 +54,8 @@ private:
|
||||
|
||||
MixerLine * m_parent;
|
||||
MixerView * m_mv;
|
||||
static QPixmap * s_qpmOn;
|
||||
static QPixmap * s_qpmOff;
|
||||
QPixmap m_qpmOff = embed::getIconPixmap("mixer_send_off", 29, 20);
|
||||
QPixmap m_qpmOn = embed::getIconPixmap("mixer_send_on", 29, 20);
|
||||
|
||||
FloatModel * getSendModel();
|
||||
};
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "Song.h"
|
||||
#include "embed.h"
|
||||
|
||||
|
||||
class QPixmap;
|
||||
@@ -205,7 +206,7 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
static QPixmap * s_posMarkerPixmap;
|
||||
QPixmap m_posMarkerPixmap = embed::getIconPixmap("playpos_marker");
|
||||
|
||||
QColor m_inactiveLoopColor;
|
||||
QBrush m_inactiveLoopBrush;
|
||||
|
||||
Reference in New Issue
Block a user