From b2261de3937e7574b4d17b055f685878c33ec319 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 24 Jul 2009 20:46:37 +0200 Subject: Work around a Sun CC 5.9 compiler bug: the threadEngine variable isn't found. QtConcurrent had the following code: template class ThreadEngineStarterBase { ... protected: ThreadEngine *threadEngine; }; template class ThreadEngineStarter : public ThreadEngineStarterBase { public: ThreadEngineStarter(ThreadEngine *threadEngine) :ThreadEngineStarterBase(threadEngine) {} [...] }; The Sun CC compiler simply didn't parse the parameter declaration in the constructor. Instead of complaining, it silently ignored the problem. Which meant that the constructor simply used the uninitialised member variable from the base class to call the parent constructor, which ended up initialised with itself. You'd think that it's just because the parameter has the same name as a member variable. But it appears to be a compiler bug altogether. If you change the name, then you start getting compile errors. This change is a workaround that worked. Reviewed-By: Bradley T. Hughes --- src/corelib/concurrent/qtconcurrentthreadengine.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/concurrent/qtconcurrentthreadengine.h b/src/corelib/concurrent/qtconcurrentthreadengine.h index 1f359fc..2f610de 100644 --- a/src/corelib/concurrent/qtconcurrentthreadengine.h +++ b/src/corelib/concurrent/qtconcurrentthreadengine.h @@ -238,9 +238,11 @@ protected: template class ThreadEngineStarter : public ThreadEngineStarterBase { + typedef ThreadEngineStarterBase Base; + typedef ThreadEngine TypedThreadEngine; public: - ThreadEngineStarter(ThreadEngine *threadEngine) - :ThreadEngineStarterBase(threadEngine) {} + ThreadEngineStarter(TypedThreadEngine *eng) + : Base(eng) { } T startBlocking() { -- cgit v0.12