Changeset 130f1094 in subsurface


Ignore:
Timestamp:
Dec 24, 2017, 11:04:10 AM (4 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
36c8a7e
Parents:
4c4222d
git-author:
Berthold Stoeger <bstoeger@…> (12/20/17 11:00:26)
git-committer:
Dirk Hohndel <dirk@…> (12/24/17 11:04:10)
Message:

Remove superfluous QScopedPointer<>s in singletons

There was a curious pattern of singletons being implemented based on
QScopedPointer<>s. This is an unnecessary level of indirection:
The lifetime of the smart pointer is the same as that of the
pointed-to object. Therefore, replace these pointers by the respective
objects.

Signed-off-by: Berthold Stoeger <bstoeger@…>

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • core/gettextfromc.cpp

    rb368ecd r130f1094  
    1919gettextFromC *gettextFromC::instance()
    2020{
    21         static QScopedPointer<gettextFromC> self(new gettextFromC());
    22         return self.data();
     21        static gettextFromC self;
     22        return &self;
    2323}
    2424
  • qt-models/cylindermodel.cpp

    r4d605ce r130f1094  
    3232{
    3333
    34         static QScopedPointer<CylindersModel> self(new CylindersModel());
    35         return self.data();
     34        static CylindersModel self;
     35        return &self;
    3636}
    3737
  • qt-models/diveplannermodel.cpp

    r603e43f r130f1094  
    413413DivePlannerPointsModel *DivePlannerPointsModel::instance()
    414414{
    415         static QScopedPointer<DivePlannerPointsModel> self(new DivePlannerPointsModel());
    416         return self.data();
     415        static DivePlannerPointsModel self;
     416        return &self;
    417417}
    418418
  • qt-models/models.cpp

    r8ef87e6 r130f1094  
    3333GasSelectionModel *GasSelectionModel::instance()
    3434{
    35         static QScopedPointer<GasSelectionModel> self(new GasSelectionModel());
    36         return self.data();
     35        static GasSelectionModel self;
     36        return &self;
    3737}
    3838
  • qt-models/tankinfomodel.cpp

    r27deb31 r130f1094  
    77TankInfoModel *TankInfoModel::instance()
    88{
    9         static QScopedPointer<TankInfoModel> self(new TankInfoModel());
    10         return self.data();
     9        static TankInfoModel self;
     10        return &self;
    1111}
    1212
  • qt-models/weigthsysteminfomodel.cpp

    r5372f12 r130f1094  
    77WSInfoModel *WSInfoModel::instance()
    88{
    9         static QScopedPointer<WSInfoModel> self(new WSInfoModel());
    10         return self.data();
     9        static WSInfoModel self;
     10        return &self;
    1111}
    1212
Note: See TracChangeset for help on using the changeset viewer.