Fix dangling pointer in KPackageJob
Review Request #129187 - Created Oct. 14, 2016 and submitted
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.
Package p = PackageLoader::self()->loadPackage(..);
Given that, I don't think this is an application error, and but a
Both plasmashell installation and uninstallation have this problem:
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.
Crashing unit test
No longer crashes.