Need suggestion on how to fix the common crash in plasma-desktop (kdelibs related)

David Faure faure at kde.org
Wed Mar 21 08:37:45 GMT 2012


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().

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().

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.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5





More information about the kde-core-devel mailing list