Assign function argument to class member, not to itself
authorBradley T. Hughes <bradley.hughes@nokia.com>
Tue, 8 Nov 2011 17:03:57 +0000 (18:03 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 9 Nov 2011 14:28:36 +0000 (15:28 +0100)
The 'worker' function argument shadows the class member of the same
name, and 'worker = worker;' assigns the function argument to itself,
not to the member as intended.

examples/tutorials/threads/movedobject/thread.cpp:69: warning:
explicitly assigning a variable of type 'QObject *' to itself [-Wself-
    worker = worker;
    ~~~~~~ ^ ~~~~~~

Change-Id: If4adf486a86a4ba4e7f7040a7771a70b7dd9aa86
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
examples/tutorials/threads/movedobject/thread.cpp

index d8a17ee..5ebd873 100644 (file)
@@ -66,7 +66,7 @@ Thread::~Thread()
 // starts thread, moves worker to this thread and blocks
 void Thread::launchWorker(QObject *worker)
 {
-    worker = worker;
+    this->worker = worker;
     start();
     worker->moveToThread(this);
     shutDownHelper->moveToThread(this);