[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/akregator/src
From: Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date: 2008-01-31 22:43:53
Message-ID: 1201819433.368956.30265.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 769254 by osterfeld:
Optimize: Avoid a particular stupid copy; revert shared_ptr usage in Article
M +14 -3 article.cpp
M +1 -1 articlemodel.cpp
A shared.h [License: BSD]
--- trunk/KDE/kdepim/akregator/src/article.cpp #769253:769254
@@ -25,6 +25,7 @@
#include "article.h"
#include "feed.h"
#include "feedstorage.h"
+#include "shared.h"
#include "storage.h"
#include "utils.h"
@@ -42,7 +43,7 @@
namespace Akregator {
-struct Article::Private
+struct Article::Private : public Shared
{
/** The status of the article is stored in an int, the bits having the
following meaning:
@@ -206,16 +207,26 @@
Article::Article(const Article &other) : d(new Private)
{
- d = other.d;
+ *this = other;
}
Article::~Article()
{
+ if ( d->deref() )
+ {
+ delete d;
+ d = 0;
+ }
}
Article &Article::operator=(const Article &other)
{
- d = other.d;
+ if (this != &other) {
+ other.d->ref();
+ if (d && d->deref())
+ delete d;
+ d = other.d;
+ }
return *this;
}
--- trunk/KDE/kdepim/akregator/src/articlemodel.cpp #769253:769254
@@ -108,7 +108,7 @@
{
if ( !index.isValid() || index.row() < 0 || index.row() >= d->articles.count() )
return QVariant();
- const Akregator::Article article = d->articles[ index.row() ];
+ const Akregator::Article& article( d->articles[ index.row() ] );
if ( article.isNull() )
return QVariant();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic