[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Need suggestion on how to fix the common crash in plasma-desktop (kdelibs related)
From: "Lamarque V. Souza" <lamarque () kde ! org>
Date: 2012-03-21 12:06:05
Message-ID: 201203210906.05209.lamarque () kde ! org
[Download RAW message or body]
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
[Attachment #3 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" \
content="1" /><style type="text/css"> p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Tahoma'; font-size:12pt; font-weight:400; \
font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Em \
Wednesday 21 March 2012, David Faure escreveu:</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">> On Tuesday 20 March 2012 22:31:57 Lamarque \
V. Souza wrote:</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> > \
WeatherEngine::~WeatherEngine() calls</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">> > WeatherEngine::unloadIons(), which \
tries to use the invalid</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">> > Plasma::DataEngineManager::self().</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> </p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> Since DataEngineManager \
uses K_GLOBAL_STATIC internally, just use the</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">> isDestroyed() method to know if it has \
already been destroyed, before</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">> calling self().</p> <p style="-qt-paragraph-type:empty; \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; "> </p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;"> I thought about doing that, but I would like to \
prevent an overhead that is needed only when plasma-{desktop,device} are exiting.</p> \
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;"> </p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> More precisely, either \
add a isDestroyed method to the public class, which</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">> calls the one in the K_GLOBAL_STATIC, or let \
self() return 0 when</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">> privateDataEngineManagerSelf.isDestroyed().</p> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;"> 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.</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"> </p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> On a more philosophical \
note: this is exactly why "intelligent destructors"</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">> are to be avoided at all \
costs. All this wouldn't happen if the</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">> WeatherEngine destructor didn't call methods \
that do stuff.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; "> </p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"> At least stuff with other object's pointer.</p> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; "> </p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">-- </p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Lamarque V. Souza</p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">KDE's Network Management \
maintainer</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">http://planetkde.org/pt-br</p></body></html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic