[Kde-imaging] NameSpace wrapper in KameraKlient removed !!!
Gilles Caulier
caulier.gilles at free.fr
Mon Sep 6 15:38:33 CEST 2004
Le lundi 6 Septembre 2004 15:22, Aurélien Gâteau a écrit :
> Le vendredi 3 Septembre 2004 14:48, Caulier Gilles a écrit :
> > Hi all,
> >
> > I have recently checked the last commits by Laurent (A patch from Tudor
> > calin) concerning this KIPI plugin. I have see that the namespace
> > KIPIKameraKlientPlugin provide by me in _all_ cpp/h files for this plugin
> > have been removed.
> >
> > This is very _Dangerous_. We must provide an independant namespace
> > wrapper for each plugin in all source code.
> >
> > I have hacked more than one plugin in the past because none namespace
> > have been used in the digikamplugins implementation. If we don't use the
> > a namespace, we have a large risk to have some memory conflics between
> > the plugin !!!
>
> I don't see why we need namespace for plugins. Each plugin gets his own .so
> file and can be considered like an application.
No exactly. I have do the same error in the past.
When Digikamplugins have been ported to KDE CVS, I have started the KIPI
support in Digikam. When this part have been done, i have checked the firsts
plugins fully available : CDArchiving and ImageGallery.
This tests have been hazardous. The applications crash many time. The reason
is a memory conflic between this plugins, and in particulary with this
implementation parts from CDArchiving and ImageGallery (old release) :
class AlbumItem : public QCheckListItem
{
public:
AlbumItem(QListView * parent, KIPI::ImageCollection album,
QString const & collection, QDate const & date,
KIO::filesize_t const & size)
: QCheckListItem( parent, album.name(), QCheckListItem::CheckBox),
_album(album), _collection(collection), _date (date), _size
(size)
{}
KIPI::ImageCollection album() { return _album; }
QString comments() { return _album.comment(); }
QString name() { return _album.name(); }
KURL path() { return _album.path(); }
QString collection() { return _album.category(); }
KURL firstImage() { return _album.images().first(); }
QDate date() { return _date; }
KIO::filesize_t size() { return _size; }
int items() { return _album.images().count(); }
void stateChange ( bool )
{
if ( AlbumItem::isOn() == true ) TargetMediaSize = TargetMediaSize +
_size;
else TargetMediaSize = TargetMediaSize - _size;
}
private:
KIPI::ImageCollection _album;
QString _collection;
QDate _date;
KIO::filesize_t _size;
};
Note this class have the same name in CDArchiving and ImageGallery.
If you said is right, i can use the same class name (this class is global) in
CDArchiving and ImageGallery...
...but it's don't work like this. In gdb, when Digikam crashing, CDArching
acceded to ImageGallery 'AlbumItem' class !!!
Using the namespace have resolved this problem !
Because the developpers work individually in each plugins, we must using
namespace...
I hope that my bad English is good for you (:=)))
Regards
--
Gilles Caulier
More information about the Kde-imaging
mailing list