Commit 5253e091 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Delete the right layerstyle object

parent 6bec7db1
......@@ -107,9 +107,6 @@ private:
struct KisLayer::Private
{
public:
KisImageWSP image;
QBitArray channelFlags;
KisMetaData::Store* metaDataStore;
......@@ -137,7 +134,12 @@ KisLayer::KisLayer(const KisLayer& rhs)
if (this != &rhs) {
m_d->image = rhs.m_d->image;
m_d->metaDataStore = new KisMetaData::Store(*rhs.m_d->metaDataStore);
m_d->layerStyle = new KisPSDLayerStyle(*rhs.m_d->layerStyle);
if (rhs.m_d->layerStyle) {
m_d->layerStyle = new KisPSDLayerStyle(*rhs.m_d->layerStyle);
}
else {
m_d->layerStyle = 0;
}
setName(rhs.name());
}
}
......@@ -180,7 +182,7 @@ KisPSDLayerStyle *KisLayer::layerStyle() const
void KisLayer::setLayerStyle(KisPSDLayerStyle *layerStyle)
{
delete layerStyle;
delete m_d->layerStyle;
m_d->layerStyle = layerStyle;
}
......
......@@ -68,8 +68,6 @@ KisPSDLayerStyle::KisPSDLayerStyle()
d->name = i18n("Unnamed");
d->version = 7;
d->visible = true;
}
KisPSDLayerStyle::~KisPSDLayerStyle()
......@@ -80,8 +78,11 @@ KisPSDLayerStyle::~KisPSDLayerStyle()
KisPSDLayerStyle::KisPSDLayerStyle(const KisPSDLayerStyle &rhs)
: d(new Private())
{
// XXX: copy all the contents of KisPSDLayerStyle::Private
}
d->name = rhs.d->name;
d->version = rhs.d->version;
d->visible = rhs.d->visible;
d->drop_shadow = rhs.d->drop_shadow;
}
void KisPSDLayerStyle::operator=(const KisPSDLayerStyle &rhs)
{
......
......@@ -904,9 +904,11 @@ void KisLayerManager::layerStyle()
KisDlgLayerStyle dlg(style);
if (dlg.exec() == QDialog::Accepted) {
layer->setLayerStyle(style);
layer->setLayerStyle(new KisPSDLayerStyle(*style));
}
delete style;
}
#include "kis_layer_manager.moc"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment