[platforms/virtual] Make VirtualOutput non-copyable
ClosedPublic

Authored by zzag on Apr 14 2018, 9:07 PM.

Details

Summary

Qt objects are treated as identities so remove the copy constructor and
an assignment operator. See, http://doc.qt.io/qt-5/object.html#identity-vs-value

IIRC some Qt objects(like QImage) have copy constructor for implicit data sharing,
but VirtualOutput doesn't have anything to share.

Also, it [this patch] fixes a compiler warning:

/home/vlad/KDE/src/kde/workspace/kwin/plugins/platforms/virtual/virtual_output.cpp: In copy constructor ‘KWin::VirtualOutput::VirtualOutput(const KWin::VirtualOutput&)’:
/home/vlad/KDE/src/kde/workspace/kwin/plugins/platforms/virtual/virtual_output.cpp:30:1: warning: base class ‘class QObject’ should be explicitly initialized in the copy constructor [-Wextra]
 VirtualOutput::VirtualOutput(const VirtualOutput &o)
 ^~~~~~~~~~~~~

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Apr 14 2018, 9:07 PM
Restricted Application added a project: KWin. · View Herald TranscriptApr 14 2018, 9:07 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Apr 14 2018, 9:07 PM
romangg accepted this revision.Apr 15 2018, 9:46 PM

Thanks for the patch. Forgot to clean this up. Just one of the two "private" labels in the header file (the above one) is enough.

This revision is now accepted and ready to land.Apr 15 2018, 9:46 PM
zzag added a comment.Apr 15 2018, 11:43 PM

Thanks for the patch. Forgot to clean this up. Just one of the two "private" labels in the header file (the above one) is enough.

Sorry, I usually don't mix declaration of fields, methods, and types under single access modifier, e.g. instead of

private:
  void doSomething();
  int m_foo;
  int m_bar;

I would write

private:
  void doSomething();

private:
  int m_foo;
  int m_bar;

I'll delete the second access modifier.

zzag updated this revision to Diff 32238.Apr 15 2018, 11:48 PM

Delete private access modifier.

This revision was automatically updated to reflect the committed changes.