Change initialization of typeRepository [Was: [Bug 201455] kdevelop crashes on startup on Windows]

David Nolden david.nolden.kdevelop at art-master.de
Fri Aug 7 06:51:42 UTC 2009


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.

Greetings, David





More information about the KDevelop-devel mailing list