mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-16 08:00:12 +02:00
Remove optional "parent" argument.
GenericThread used to accept an optional "parent" argument, defaulting to nullptr. This was odd, because the moveToThread() in GenericThread::initialize() would become a no-op if the instance ever inits QObject(someNonNullParentQObject). (The only clue would be a log message "QObject::moveToThread: Cannot move objects with a parent", and things would end up in the same thread that created the instance.) As it turns out, all the subclasses of GenericThread do not init GenericThread(parent), so things worked as expected.
This commit is contained in:
parent
5572840133
commit
3f5744712f
4 changed files with 5 additions and 13 deletions
|
@ -16,15 +16,7 @@
|
|||
#include <display-plugins/DisplayPlugin.h>
|
||||
#include "InterfaceLogging.h"
|
||||
|
||||
// GenericThread accepts an optional "parent" argument, defaulting to nullptr.
|
||||
// This is odd, because the moveToThread() in GenericThread::initialize() will
|
||||
// become a no-op if the instance ever inits QObject(someNonNullParentQObject).
|
||||
// (The only clue will be a log message "QObject::moveToThread: Cannot move objects with a parent",
|
||||
// and things will end up in the same thread that created this instance. Hillarity ensues.)
|
||||
// As it turns out, all the other subclasses of GenericThread (at this time) do not init
|
||||
// GenericThread(parent), so things work as expected. Here we explicitly init GenericThread(nullptr)
|
||||
// so that there is no confusion and no chance for a hillarious thread debugging session.
|
||||
AvatarUpdate::AvatarUpdate() : GenericThread(nullptr), _lastAvatarUpdate(0) {
|
||||
AvatarUpdate::AvatarUpdate() : GenericThread(), _lastAvatarUpdate(0) {
|
||||
setObjectName("Avatar Update"); // GenericThread::initialize uses this to set the thread name.
|
||||
Settings settings;
|
||||
const int DEFAULT_TARGET_AVATAR_SIMRATE = 60;
|
||||
|
|
|
@ -24,7 +24,7 @@ class GenericQueueThread : public GenericThread {
|
|||
public:
|
||||
using Queue = QQueue<T>;
|
||||
GenericQueueThread(QObject* parent = nullptr)
|
||||
: GenericThread(parent) {}
|
||||
: GenericThread() {}
|
||||
|
||||
virtual ~GenericQueueThread() {}
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#include "GenericThread.h"
|
||||
|
||||
|
||||
GenericThread::GenericThread(QObject* parent) :
|
||||
QObject(parent),
|
||||
GenericThread::GenericThread() :
|
||||
QObject(),
|
||||
_stopThread(false),
|
||||
_isThreaded(false) // assume non-threaded, must call initialize()
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
class GenericThread : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GenericThread(QObject* parent = nullptr);
|
||||
GenericThread();
|
||||
virtual ~GenericThread();
|
||||
|
||||
/// Call to start the thread.
|
||||
|
|
Loading…
Reference in a new issue