New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update use of Q_DISABLE_COPY. #1352
Conversation
…r Q_DISABLE_COPY_MOVE)
The following links are available:
build (windows-latest, full) |
interface/src/avatar/MyHead.h
Outdated
@@ -23,8 +23,8 @@ class MyHead : public Head { | |||
|
|||
private: | |||
// disallow copies of the Head, copy of owning Avatar is disallowed too | |||
MyHead(const Head&); | |||
MyHead& operator= (const MyHead&); | |||
MyHead(const Head&) = delete; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not Q_DISABLE_COPY here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because Head != MyHead. Thus my question in the first comment as to whether this is a bug or typo in the code, I'm struggling to make sense of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good point. I'll take a look at that later and see if I can figure it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to think about it... that is a non-copy constructor and thus deleting it has no effect, we're only focused on the compiler-generated objects which at this point are copy-constructor, move-constructor, assign-self and assign-move, right?
So at best that line is useless and is likely a typo. I'm okay with replacing it with a Q_DISABLE_COPY and see what breaks, if nothing does we can consider it good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think this is a mistake.
You can't copy a Head into a MyHead, because where would whatever is added in MyHead come from? Such a thing can't happen automatically, so forbidding it even if legal shouldn't do anything.
Also, the comment in Head.h is identical, suggesting that it was copy/pasted from there and left by mistake.
So I think just Q_DISABLE_COPY it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Think I already ended up doing that in a later commit too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I noticed the commit just a second too late.
The following links are available: build (macOS-latest, full) build (ubuntu-18.04, full)
build (windows-latest, full) |
This attempts to find and replace most instances of "do not copy this class" code with Q_DISABLE_COPY. This:
There are a few places that I did not replace the code:
Testing focus: