From a90585a246de4ae800432b94ab3ca102f9e8b2bc Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 26 Sep 2013 13:19:42 +0200 Subject: Fix QWinJumpList::clear() for recent & frequent categories It must actually instantiate the recent & frequent categories in order for clear() to be effective. Change-Id: Ic3fc9c95a1170b21f257637eaaac080e1c30db9a Reviewed-by: Ivan Vizir Reviewed-by: Friedemann Kleint --- src/winextras/qwinjumplist.cpp | 44 +++++++++++++++--------------------------- src/winextras/qwinjumplist_p.h | 2 +- 2 files changed, 17 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/winextras/qwinjumplist.cpp b/src/winextras/qwinjumplist.cpp index 6fd61c9..e6f2bb0 100644 --- a/src/winextras/qwinjumplist.cpp +++ b/src/winextras/qwinjumplist.cpp @@ -140,31 +140,15 @@ void QWinJumpListPrivate::_q_rebuild() dirty = false; } -void QWinJumpListPrivate::destroy(bool clear) +void QWinJumpListPrivate::destroy() { - if (recent) { - if (clear) - recent->clear(); - delete recent; - recent = 0; - } - if (frequent) { - if (clear) - frequent->clear(); - delete frequent; - frequent = 0; - } - if (tasks) { - if (clear) - tasks->clear(); - delete tasks; - tasks = 0; - } - foreach (QWinJumpListCategory *category, categories) { - if (clear) - category->clear(); - delete category; - } + delete recent; + recent = 0; + delete frequent; + frequent = 0; + delete tasks; + tasks = 0; + qDeleteAll(categories); categories.clear(); invalidate(); } @@ -440,8 +424,7 @@ QWinJumpList::~QWinJumpList() d->pDestList->Release(); d->pDestList = 0; } - const bool clear = false; - d->destroy(clear); + d->destroy(); } /*! @@ -525,8 +508,13 @@ QWinJumpListCategory *QWinJumpList::addCategory(const QString &title, const QLis void QWinJumpList::clear() { Q_D(QWinJumpList); - const bool clear = true; - d->destroy(clear); + recent()->clear(); + frequent()->clear(); + if (d->tasks) + d->tasks->clear(); + foreach (QWinJumpListCategory *category, d->categories) + category->clear(); + d->destroy(); } QT_END_NAMESPACE diff --git a/src/winextras/qwinjumplist_p.h b/src/winextras/qwinjumplist_p.h index c30d64b..ca21e33 100644 --- a/src/winextras/qwinjumplist_p.h +++ b/src/winextras/qwinjumplist_p.h @@ -65,7 +65,7 @@ public: void invalidate(); void _q_rebuild(); - void destroy(bool clear); + void destroy(); bool beginList(); bool commitList(); -- cgit v1.2.3