diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-07 16:11:18 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-07 16:11:18 +0200 |
commit | b035546f9976a984474a45bb61aa7767f88a7bd3 (patch) | |
tree | 7305fdeed75e4f373a68e635696a80719a8e3a98 | |
parent | 0a12032317eb037adc44d9a083b0ed2db7ecb709 (diff) | |
download | sink-b035546f9976a984474a45bb61aa7767f88a7bd3.tar.gz sink-b035546f9976a984474a45bb61aa7767f88a7bd3.zip |
Never allocate KJob subclasses on the stack
The delete themselves.
-rw-r--r-- | examples/caldavresource/tests/caldavtest.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/examples/caldavresource/tests/caldavtest.cpp b/examples/caldavresource/tests/caldavtest.cpp index aadd580..b9886fa 100644 --- a/examples/caldavresource/tests/caldavtest.cpp +++ b/examples/caldavresource/tests/caldavtest.cpp | |||
@@ -268,18 +268,18 @@ private slots: | |||
268 | url.setUserName(username); | 268 | url.setUserName(username); |
269 | url.setPassword(password); | 269 | url.setPassword(password); |
270 | KDAV2::DavUrl davurl(url, KDAV2::CalDav); | 270 | KDAV2::DavUrl davurl(url, KDAV2::CalDav); |
271 | KDAV2::DavCollectionsFetchJob collectionsJob(davurl); | 271 | auto collectionsJob = new KDAV2::DavCollectionsFetchJob(davurl); |
272 | collectionsJob.exec(); | 272 | collectionsJob->exec(); |
273 | Q_ASSERT(collectionsJob.error() == 0); | 273 | Q_ASSERT(collectionsJob->error() == 0); |
274 | return collectionsJob.collections()[0]; | 274 | return collectionsJob->collections()[0]; |
275 | })(); | 275 | })(); |
276 | 276 | ||
277 | auto itemList = ([&collection]() -> KDAV2::DavItem::List { | 277 | auto itemList = ([&collection]() -> KDAV2::DavItem::List { |
278 | auto cache = std::make_shared<KDAV2::EtagCache>(); | 278 | auto cache = std::make_shared<KDAV2::EtagCache>(); |
279 | KDAV2::DavItemsListJob itemsListJob(collection.url(), cache); | 279 | auto itemsListJob = new KDAV2::DavItemsListJob(collection.url(), cache); |
280 | itemsListJob.exec(); | 280 | itemsListJob->exec(); |
281 | Q_ASSERT(itemsListJob.error() == 0); | 281 | Q_ASSERT(itemsListJob->error() == 0); |
282 | return itemsListJob.items(); | 282 | return itemsListJob->items(); |
283 | })(); | 283 | })(); |
284 | auto hollowDavItemIt = | 284 | auto hollowDavItemIt = |
285 | std::find_if(itemList.begin(), itemList.end(), [this](const KDAV2::DavItem &item) { | 285 | std::find_if(itemList.begin(), itemList.end(), [this](const KDAV2::DavItem &item) { |
@@ -288,10 +288,10 @@ private slots: | |||
288 | 288 | ||
289 | auto davitem = ([this, &collection, &hollowDavItemIt]() -> KDAV2::DavItem { | 289 | auto davitem = ([this, &collection, &hollowDavItemIt]() -> KDAV2::DavItem { |
290 | QString itemUrl = collection.url().url().toEncoded() + addedEventUid; | 290 | QString itemUrl = collection.url().url().toEncoded() + addedEventUid; |
291 | KDAV2::DavItemFetchJob itemFetchJob(*hollowDavItemIt); | 291 | auto itemFetchJob = new KDAV2::DavItemFetchJob (*hollowDavItemIt); |
292 | itemFetchJob.exec(); | 292 | itemFetchJob->exec(); |
293 | Q_ASSERT(itemFetchJob.error() == 0); | 293 | Q_ASSERT(itemFetchJob->error() == 0); |
294 | return itemFetchJob.item(); | 294 | return itemFetchJob->item(); |
295 | })(); | 295 | })(); |
296 | 296 | ||
297 | auto incidence = KCalCore::ICalFormat().readIncidence(davitem.data()); | 297 | auto incidence = KCalCore::ICalFormat().readIncidence(davitem.data()); |
@@ -302,9 +302,9 @@ private slots: | |||
302 | auto newical = KCalCore::ICalFormat().toICalString(calevent); | 302 | auto newical = KCalCore::ICalFormat().toICalString(calevent); |
303 | 303 | ||
304 | davitem.setData(newical.toUtf8()); | 304 | davitem.setData(newical.toUtf8()); |
305 | KDAV2::DavItemModifyJob itemModifyJob(davitem); | 305 | auto itemModifyJob = new KDAV2::DavItemModifyJob(davitem); |
306 | itemModifyJob.exec(); | 306 | itemModifyJob->exec(); |
307 | QVERIFY2(itemModifyJob.error() == 0, "Cannot modify item"); | 307 | QVERIFY2(itemModifyJob->error() == 0, "Cannot modify item"); |
308 | } | 308 | } |
309 | 309 | ||
310 | // Try to change the item with sink | 310 | // Try to change the item with sink |