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: BUG: 370718 BUG: 369935 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
Showing
- autotests/plasmoidpackagetest.cpp 31 additions, 1 deletionautotests/plasmoidpackagetest.cpp
- autotests/plasmoidpackagetest.h 1 addition, 0 deletionsautotests/plasmoidpackagetest.h
- src/kpackage/package.cpp 9 additions, 0 deletionssrc/kpackage/package.cpp
- src/kpackage/private/package_p.h 20 additions, 0 deletionssrc/kpackage/private/package_p.h
- src/kpackage/private/packagejob.cpp 12 additions, 1 deletionsrc/kpackage/private/packagejob.cpp
Loading
Please register or sign in to comment