View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002787 | Scribus | Internal | public | 2005-11-02 22:48 | 2005-11-05 12:44 |
Reporter | cbradney | Assigned To | cbradney | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Athlon XP 2600+ 1gb ram | OS | Gentoo Linux | OS Version | Up to date |
Product Version | 1.3.1cvs | ||||
Fixed in Version | 1.3.2cvs | ||||
Summary | 0002787: Memory leak in colour pixmap caches | ||||
Description | Fixes, recording for posterity's sake. | ||||
Tags | No tags attached. | ||||
Patch | |||||
2005-11-02 23:24
|
scribus-bug-2787-memory-leak-fix.patch (1,149 bytes)
--- util.cpp 2005-09-17 05:55:05.000000000 +0200 +++ utilmemleakfixed.cpp 2005-11-03 00:22:32.000000000 +0100 @@ -1201,20 +1201,20 @@ { static QMap<QRgb, QPixmap*> pxCache; - QPixmap * pm = pxCache[rgb.rgb()]; - if (!pm) - { - pm = new QPixmap(15, 15); - pm->fill(rgb); - QPainter p; - p.begin(pm); - p.setBrush(Qt::NoBrush); - QPen b(Qt::black, 1); - p.setPen(b); - p.drawRect(0, 0, 15, 15); - p.end(); - pxCache[rgb.rgb()] = pm; - } + QRgb index=rgb.rgb(); + if (pxCache.contains(index)) + return pxCache[index]; + + QPixmap *pm = new QPixmap(15, 15); + pm->fill(rgb); + QPainter p; + p.begin(pm); + p.setBrush(Qt::NoBrush); + QPen b(Qt::black, 1); + p.setPen(b); + p.drawRect(0, 0, 15, 15); + p.end(); + pxCache.insert(index, pm); return pm; } @@ -1222,12 +1222,13 @@ { static QMap<QRgb, QPixmap*> pxCache; - QPixmap * pm = pxCache[rgb.rgb()]; - if (!pm) { - pm = new QPixmap(30, 15); - pm->fill(rgb); - pxCache[rgb.rgb()] = pm; - } + QRgb index=rgb.rgb(); + if (pxCache.contains(index)) + return pxCache[index]; + + QPixmap *pm = new QPixmap(30, 15); + pm->fill(rgb); + pxCache.insert(index, pm); return pm; } |
|
http://bugs.gentoo.org/show_bug.cgi?id=111300 also. |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-11-02 22:48 | cbradney | New Issue | |
2005-11-02 23:05 | cbradney | File Added: scribus-bug-2787-memory-leak-fix.patch | |
2005-11-02 23:24 | cbradney | File Deleted: scribus-bug-2787-memory-leak-fix.patch | |
2005-11-02 23:24 | cbradney | File Added: scribus-bug-2787-memory-leak-fix.patch | |
2005-11-02 23:25 | cbradney | Status | assigned => resolved |
2005-11-02 23:25 | cbradney | Fixed in Version | => 1.3.2cvs |
2005-11-02 23:25 | cbradney | Resolution | open => fixed |
2005-11-02 23:25 | cbradney | Note Added: 0007313 | |
2005-11-05 12:44 | cbradney | Status | resolved => closed |