Change initialization of typeRepository [Was: [Bug 201455] kdevelop crashes on startup on Windows]
Andreas Pakulat
apaku at gmx.de
Fri Aug 7 07:21:02 UTC 2009
On 07.08.09 08:51:42, David Nolden wrote:
> Am Freitag 07 August 2009 06:47:54 schrieb Andreas Pakulat:
> > Thanks Yaron for the analysis. The attached patch should fix the
> > initialization, however I'd like to have a comment from David wether
> > this could potentially break something. David?
> >
> > I couldn't test wether this helps on windows, but at least it doesn't
> > seem to break anything on linux.
>
> Looks like it cannot break anything, but I hate introducing these new
> additional functions everywhere. The class "RepositoryManager" is ment to fix
> these problems, and it already contains one function-call with each access to
> the repository. See "RepositoryManager::operator->()". So instances of
> RepositoryManager should just be global variables, and not be double-hidden
> behind a function.
>
> In this case, it _really_ matters, as this is accessed _very_ frequently.
>
> So the better solution would be solving the problem in RepositoryManager:
> Instead of directly taking the "shareMutex" variable in constructor, which
> leads to the problematic function call, it should take another template
> parameter like:
> "
> struct InstantiationInformationManagerData {
> static AbstractRepositoryManager* shareMutex () {
> return typeRepositoryManager();
> }
> };
> "
>
> And that would then be used in RepositoryManager::createRepository, which
> means that the function would be called on first use of the repository,
> instead of during static initialization, without paying an additional
> performance penalty.
I don't have the code in front of me right now, but the description lost me
after the "very frequently" :) Do you have time to do this over the
weekend? If not I'll take a shot and try to post a patch.
Andreas
--
Learn to pause -- or nothing worthwhile can catch up to you.
More information about the KDevelop-devel
mailing list