Em Wednesday 21 March 2012, David Faure escreveu: > On Tuesday 20 March 2012 22:31:57 Lamarque V. Souza wrote: > > WeatherEngine::~WeatherEngine() calls > > WeatherEngine::unloadIons(), which tries to use the invalid > > Plasma::DataEngineManager::self(). > > Since DataEngineManager uses K_GLOBAL_STATIC internally, just use the > isDestroyed() method to know if it has already been destroyed, before > calling self().
I thought about doing that, but I would like to prevent an overhead that is needed only when plasma-{desktop,device} are exiting. > More precisely, either add a isDestroyed method to the public class, which > calls the one in the K_GLOBAL_STATIC, or let self() return 0 when > privateDataEngineManagerSelf.isDestroyed(). The Plasma::DataEngineManager::valid() I suggested is exactly returning the negation of privateDataEngineManagerSelf.isDestroyed(). I just wanted to know if there were other options. Ok, let's add a Plasma::DataEngineManager::isDestroyed(). Can I backport that to 4.8? Wrong question, I will have to it to 4.8 so that somebody forward ports it to master, duh. > On a more philosophical note: this is exactly why "intelligent destructors" > are to be avoided at all costs. All this wouldn't happen if the > WeatherEngine destructor didn't call methods that do stuff. At least stuff with other object's pointer. -- Lamarque V. Souza KDE's Network Management maintainer http://planetkde.org/pt-br