D14666: Fixes memory leak in KUrlComboBox::setUrl

David Faure noreply at phabricator.kde.org
Tue Aug 7 15:54:06 BST 2018


dfaure requested changes to this revision.
dfaure added a comment.
This revision now requires changes to proceed.


  Thanks ;)

INLINE COMMENTS

> kurlcombobox.cpp:358
> +                if (d->itemList.at(i).get() == mit.value()) {
> +                    d->itemList.erase(d->itemList.begin() + i);
> +                    break;

problem: `i` shouldn't be in increased after this...

Maybe this should use iterators instead?

A unitttest is missing for this code path, in any case.

> kurlcombobox.cpp:365
> +                    if (d->defaultList.at(i).get() == mit.value()) {
> +                        d->defaultList.erase(d->defaultList.begin() + i);
> +                        break;

same here.

Maybe erase(remove_if()) would be best.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D14666

To: hallas, dfaure
Cc: dfaure, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180807/8aa8f8d8/attachment.html>


More information about the Kde-frameworks-devel mailing list