https://bugs.kde.org/show_bug.cgi?id=369935

David Edmundson <k...@davidedmundson.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|                            |http://commits.kde.org/kpac
                   |                            |kage/cfb69e21fb0aad92f40348
                   |                            |7b4c8a75b2b0bc8041
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from David Edmundson <k...@davidedmundson.co.uk> ---
Git commit cfb69e21fb0aad92f403487b4c8a75b2b0bc8041 by David Edmundson.
Committed on 16/10/2016 at 12:13.
Pushed by davidedmundson into branch 'master'.

Fix dangling pointer in KPackageJob

A KPackage::Package object uses qexplicitlyshareddata, and it designed
to be kept on the stack and copied. However, PackageJob takes a pointer
to a package, which it later updates, which is expected to exist for the
lifecycle of the job.

This means

Package p = PackageLoader::self()->loadPackage(..);
p.install();

will crash.

Given that, I don't think this is an application error, and but a
library bug.

Both plasmashell installation and uninstallation have this problem:
Related: bug 370718

As Package is not a QObject we can't just use a QWeakPointer, and
we can't just copy the Package in the packagejob as we need to detatch
and update the \*original\* KPackage instance. Also to match behaviour
we need to do this without changing any other
KPackage instances sharing the same shareddata.

Not a neat fix at all, but there aren't many options that work
without breaking API or behaviour.

REVIEW: 129187

M  +31   -1    autotests/plasmoidpackagetest.cpp
M  +1    -0    autotests/plasmoidpackagetest.h
M  +9    -0    src/kpackage/package.cpp
M  +20   -0    src/kpackage/private/package_p.h
M  +12   -1    src/kpackage/private/packagejob.cpp

http://commits.kde.org/kpackage/cfb69e21fb0aad92f403487b4c8a75b2b0bc8041

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to