Created attachment 106264 [details] check the d_ptr before using it The KDirWatch dtor assumes that it always has a KDirWatchPrivate instance, an assumption not shared by (most of) the other class methods. I stumbled upon this during what could be called foolproofing (testing plasmoid with plasmawindowed outside of a running Plasma5 environment).
I think this makes sense. Seems to me that the current code could lead to a crash if the KDirWatch qPostRoutine were called (this nullifies the d-ptr) followed by the KDirWatch itself being destructed. David, any thoughts on whether there's a better way to handle this?
This patch looks fine, please push it.
Git commit b8cb28bcd0709a0ff49ac1ae40c0f44e7ea36f33 by Michael Pyne, on behalf of René J.V. Bertin. Committed on 08/07/2017 at 19:00. Pushed by mpyne into branch 'master'. kdirwatch: Avoid potential crash if d-ptr destroyed before KDirWatch. Found in a code review and patch proposed by René, although we've not actually gone so far as to create a test case that forces a crash. Committed by mpyne to get the bug closed out. FIXED-IN:5.37 M +1 -1 src/lib/io/kdirwatch.cpp https://commits.kde.org/kcoreaddons/b8cb28bcd0709a0ff49ac1ae40c0f44e7ea36f33
*** Bug 368278 has been marked as a duplicate of this bug. ***