[mythtv-commits] Ticket #13069: Fix QObject related compile warnings in trunk
MythTV
noreply at mythtv.org
Sat Jul 15 15:28:19 UTC 2017
#13069: Fix QObject related compile warnings in trunk
------------------------------------------+-------------------------
Reporter: David Hampton <mythtv@…> | Owner:
Type: Developer Task | Status: new
Priority: minor | Milestone: 29.0
Component: MythTV - General | Version: Master Head
Severity: medium | Keywords:
Ticket locked: 0 |
------------------------------------------+-------------------------
These fixes originated from compiler warnings generated from adding
the -Wextra flag to the build. This pull request only addresses
changes related to fixing this error:
In copy constructor ‘blah::blah(const blah&)’:
warning: base class ‘class blah’ should be explicitly initialized
in the copy constructor [-Wextra]
Implementing explicit initializers for these objects results in an
error instead of a warning:
In copy constructor ‘blah::blah(const blah&)’:
error: ‘QObject::QObject(const QObject&)’ is private within
this context : QObject(other)
/usr/include/qt5/QtCore/qobject.h: note: declared private here
Q_DISABLE_COPY(QObject)
Fix these errors by doing the following:
1) FileSystemInfo and MetaGrabberScript don't use any of the features of
QObject, so make them standalone classes.
2) Remove public copy constructors from MythSystemLegacy. This object
uses Qt signals, so it has to be based on QObject.
3) Remove the copy constructor from MythCookieJar. Do this by
splitting it into its two components; creating a new jar and
copying cookies from one jar to another. This is probably not the
ideal solution, but it has the smallest impact on the existing code
base. (An better solution would allow cookiejars to be created
once, and then copy cookies back and forth. This would eliminate
the need to destroy and recreate the jar on each copy.)
4) Clean up the RecStatus object. This object is essentially an enum
with some related functions. It doesn't ever appear to actually be
instantiated as an object. This object is based on QObject and
therefore the object itself cannot be used with the Qt metatype
system. The pointer, however, is automatically registered with the
metatype system (as are pointers to all QObject derived classes).
Remove the copy constructor and the unnecessary/duplicate metatype
declaration/registration code.
5) Clean up all the data/service contract objects that are based on
QObject. Like RecStatus, the objects themselves cannot be used
with the Qt MetaType system, and the pointers are automatically
registered. This allows all of the declaration/registration code
to be removed from the files. Removing the registration code
allows all of the InitializeCustomTypes functions go away, which
allows the service object constructors to be cleaned up.
The CopyListContents code also needs to be simplified to not convert
from pointer to object to reference, because this causes an implicit
copy of the object. That means that all the object copy functions need
to be updated to use pointers instead of references.
6) Create a test framework for the data contracts. This currently
builds five different types of objects, converts them to a QVariant
and back, and then compares the results to the original. It should
be expanded to all the data objects, and other tests added.
These changes have been tested by working through most of the menu
items in mythfrontend, and by working through most of the items in the
new web frontend.
--
Ticket URL: <https://code.mythtv.org/trac/ticket/13069>
MythTV <http://www.mythtv.org>
MythTV Media Center
More information about the mythtv-commits
mailing list