kdeplasma-addons: parent the weather validator to the weather location finder

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-07-15 10:43:00 +03:00
parent 7f129d6c3e
commit 7bb0c86cf6
4 changed files with 9 additions and 9 deletions

View file

@ -28,7 +28,8 @@ class WeatherLocation::Private
public: public:
Private(WeatherLocation *location) Private(WeatherLocation *location)
: q(location), : q(location),
locationEngine(nullptr) locationEngine(nullptr),
weatherEngine(nullptr)
{ {
} }
@ -64,8 +65,7 @@ WeatherLocation::WeatherLocation(QObject *parent)
WeatherLocation::~WeatherLocation() WeatherLocation::~WeatherLocation()
{ {
qDeleteAll(d->validators.keys()); Q_ASSERT(d->validators.size() == 0);
d->validators.clear();
delete d; delete d;
} }
@ -98,7 +98,7 @@ void WeatherLocation::dataUpdated(const QString &source, const Plasma::DataEngin
city.truncate(city.indexOf(QLatin1Char(',')) - 1); city.truncate(city.indexOf(QLatin1Char(',')) - 1);
} }
if (!city.isEmpty()) { if (!city.isEmpty()) {
WeatherValidator* validator = new WeatherValidator(); WeatherValidator* validator = new WeatherValidator(this);
validator->setDataEngine(d->weatherEngine); validator->setDataEngine(d->weatherEngine);
connect( connect(
validator, SIGNAL(finished(QMap<QString,QString>)), validator, SIGNAL(finished(QMap<QString,QString>)),

View file

@ -81,9 +81,9 @@ public:
q->setBusy(false); q->setBusy(false);
q->showMessage(QIcon(), QString(), Plasma::ButtonNone); q->showMessage(QIcon(), QString(), Plasma::ButtonNone);
q->setConfigurationRequired(true); q->setConfigurationRequired(true);
location->deleteLater();
location = 0;
} }
delete location;
location = 0;
} }
void giveUpBeingBusy() void giveUpBeingBusy()

View file

@ -26,7 +26,7 @@ class WeatherValidator::Private
{ {
public: public:
Private() Private()
: dataengine(0), : dataengine(nullptr),
ion(QLatin1String( "wettercom" )) ion(QLatin1String( "wettercom" ))
{} {}
@ -36,7 +36,7 @@ public:
bool silent; bool silent;
}; };
WeatherValidator::WeatherValidator(QWidget *parent) WeatherValidator::WeatherValidator(QObject *parent)
: QObject(parent) : QObject(parent)
, d(new Private()) , d(new Private())
{ {

View file

@ -33,7 +33,7 @@ class PLASMAWEATHER_EXPORT WeatherValidator : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
WeatherValidator(QWidget *parent = 0); WeatherValidator(QObject *parent = 0);
virtual ~WeatherValidator(); virtual ~WeatherValidator();
/** /**