Commit 67b5c56e authored by Christoph Feck's avatar Christoph Feck
Browse files

Fix assignment operator and add copy constructor

This fixes the crash in Grid Desktop and Grouping Desktop.
Thanks to Aaron Seigo for investigation and patch review.

BUG: 278222
FIXED-IN: 4.7.1
parent 4f6b5b70
......@@ -43,6 +43,12 @@ GroupInfo::GroupInfo(const QString &name, const QString &prettyName)
d->prettyName = prettyName;
}
GroupInfo::GroupInfo(const GroupInfo &other)
: d(new GroupInfoPrivate())
{
*d = *other.d;
}
GroupInfo::~GroupInfo()
{
delete d;
......@@ -78,13 +84,12 @@ QString GroupInfo::icon() const
return d->icon;
}
GroupInfo GroupInfo::operator=(const GroupInfo &gi)
GroupInfo &GroupInfo::operator=(const GroupInfo &gi)
{
GroupInfo g(gi.name(), gi.prettyName());
g.setFormFactors(gi.formFactors());
g.setIcon(gi.icon());
return g;
if (this != &gi) {
*d = *gi.d;
}
return *this;
}
bool GroupInfo::operator==(const GroupInfo &gi) const
......
......@@ -31,6 +31,7 @@ class GroupInfo
{
public:
explicit GroupInfo(const QString &name, const QString &prettyName = QString());
GroupInfo(const GroupInfo &other);
~GroupInfo();
void setFormFactors(QSet<Plasma::FormFactor> formFactors);
void setIcon(const QString &icon);
......@@ -40,7 +41,7 @@ class GroupInfo
QSet<Plasma::FormFactor> formFactors() const;
QString icon() const;
GroupInfo operator=(const GroupInfo &gi);
GroupInfo &operator=(const GroupInfo &gi);
bool operator==(const GroupInfo &gi) const;
bool operator<(const GroupInfo &gi) const;
......
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