extragear/sdk/kdevplatform

Andreas Pakulat apaku at gmx.de
Sun Jan 17 13:55:40 UTC 2010


On 17.01.10 11:37:57, David Nolden wrote:
> Am Sonntag 17 Januar 2010 02:54:00 schrieb Andreas Pakulat:
> > On 17.01.10 00:07:18, David Nolden wrote:
> > > SVN commit 1075910 by zwabel:
> > >
> > > Add a "bool ICore::shuttingDown()" function that allows determining
> > > whether we're shutting down in a clean way.
> > 
> > This is wrong. Public API should be added because its useful, not to
> > workaround problems in the design of certain components. And this
> > function is potentially dangerous even, as plugin authors start to use
> > that in all places they want to protect, instead of implementing a
> > proper cleanup function.
> > 
> > Please revert and either fix this properly (without such a crude hack)
> > or live with the deadlock.
> 
> KDevelop consists of tens of different components, and they all may depend on 
> each other.

There's a way to define dependencies and that means there's also a way
to shut those dependencies down in the right order.

> When one thing does something (for example the cpp parser), then 
> it needs a _proper_ way to know whether the application is still in a well-
> defined state, or whether it is shutting down.
> 
> IMO this has to be public API, because the shutdown process is a part of the 
> application runtime as well. Until now every plugin that needed this 
> information has implemented some ugly hack to detect the "shutting down" state 
> (like for example CppLaguageSupport::self() == 0), but this one is the only 
> real solution. Why do you think it is a hack?

Because there is already a proper way to know when a shutdown happens:
Each plugin and each controller has a cleanup function, which was
introduced for exactly that purpose. Do your cleanup there, in
particular I think that if parse-jobs cannot be killed at any time, then
the backgroundparser needs to wait for all running jobs to complete
before his cleanup should return.

You already start to clutter this all over your C++ code and instead of
a clear flow of shutdown we have spagetthi code everywhere to make sure
that "nothing bad happens in case X is still running even though we're
shutting down already". Thats just ugly IMHO.

Andreas 

-- 
Next Friday will not be your lucky day.  As a matter of fact, you don't
have a lucky day this year.




More information about the KDevelop-devel mailing list