mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
libs: plug memory and X11 pixmaps leaks
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
92120589bc
commit
06aa57376f
2 changed files with 12 additions and 7 deletions
|
@ -36,7 +36,7 @@ class PanelShadows::Private
|
|||
public:
|
||||
Private(PanelShadows *shadows)
|
||||
: q(shadows),
|
||||
m_managePixmaps(false),
|
||||
m_managePixmaps(true),
|
||||
top(0),
|
||||
right(0),
|
||||
bottom(0),
|
||||
|
@ -76,6 +76,11 @@ PanelShadows::PanelShadows(QObject *parent)
|
|||
connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateShadows()));
|
||||
}
|
||||
|
||||
PanelShadows::~PanelShadows()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void PanelShadows::addWindow(const QWidget *window)
|
||||
{
|
||||
if (!window || !window->isWindow()) {
|
||||
|
@ -121,11 +126,13 @@ void PanelShadows::Private::updateShadows()
|
|||
|
||||
void PanelShadows::Private::initPixmap(const QString &element)
|
||||
{
|
||||
kDebug() << "Initializing pixmap" << element;
|
||||
m_shadowPixmaps << KPixmap(q->pixmap(element));
|
||||
}
|
||||
|
||||
void PanelShadows::Private::setupPixmaps()
|
||||
{
|
||||
kDebug() << "Setting up pixmaps";
|
||||
clearPixmaps();
|
||||
initPixmap("shadow-top");
|
||||
initPixmap("shadow-topright");
|
||||
|
@ -183,12 +190,9 @@ void PanelShadows::getMargins(int &top, int &right, int &bottom, int &left)
|
|||
|
||||
void PanelShadows::Private::clearPixmaps()
|
||||
{
|
||||
#warning FIXME: pixmaps are leaked
|
||||
if (m_managePixmaps) {
|
||||
foreach (KPixmap &pixmap, m_shadowPixmaps) {
|
||||
pixmap.release();
|
||||
}
|
||||
m_managePixmaps = false;
|
||||
kDebug() << "Clearing pixmaps";
|
||||
foreach (KPixmap &pixmap, m_shadowPixmaps) {
|
||||
pixmap.release();
|
||||
}
|
||||
m_shadowPixmaps.clear();
|
||||
data.clear();
|
||||
|
|
|
@ -31,6 +31,7 @@ class PLASMAGENERICSHELL_EXPORT PanelShadows : public Plasma::Svg
|
|||
|
||||
public:
|
||||
explicit PanelShadows(QObject *parent = 0);
|
||||
~PanelShadows();
|
||||
|
||||
void addWindow(const QWidget *window);
|
||||
void removeWindow(const QWidget *window);
|
||||
|
|
Loading…
Add table
Reference in a new issue