Browse Source

Merge pull request #15444 from Chocobo1/guard

Prevent self-assignment in assignment operator
adaptive-webui-19844
Chocobo1 3 years ago committed by GitHub
parent
commit
6de0622c1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/base/bittorrent/torrentinfo.cpp
  2. 3
      src/base/rss/rss_autodownloadrule.cpp
  3. 4
      src/gui/raisedmessagebox.h

3
src/base/bittorrent/torrentinfo.cpp

@ -87,8 +87,11 @@ TorrentInfo::TorrentInfo(const TorrentInfo &other)
} }
TorrentInfo &TorrentInfo::operator=(const TorrentInfo &other) TorrentInfo &TorrentInfo::operator=(const TorrentInfo &other)
{
if (this != &other)
{ {
m_nativeInfo = other.m_nativeInfo; m_nativeInfo = other.m_nativeInfo;
}
return *this; return *this;
} }

3
src/base/rss/rss_autodownloadrule.cpp

@ -439,8 +439,11 @@ bool AutoDownloadRule::accepts(const QVariantHash &articleData)
} }
AutoDownloadRule &AutoDownloadRule::operator=(const AutoDownloadRule &other) AutoDownloadRule &AutoDownloadRule::operator=(const AutoDownloadRule &other)
{
if (this != &other)
{ {
m_dataPtr = other.m_dataPtr; m_dataPtr = other.m_dataPtr;
}
return *this; return *this;
} }

4
src/gui/raisedmessagebox.h

@ -33,6 +33,7 @@
class RaisedMessageBox final : public QMessageBox class RaisedMessageBox final : public QMessageBox
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY_MOVE(RaisedMessageBox)
public: public:
static QMessageBox::StandardButton critical(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); static QMessageBox::StandardButton critical(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
@ -45,9 +46,6 @@ protected:
private: private:
RaisedMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = NoButton, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint); RaisedMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = NoButton, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog|Qt::MSWindowsFixedSizeDialogHint);
RaisedMessageBox();
RaisedMessageBox(RaisedMessageBox const&);
void operator=(RaisedMessageBox const&);
static QMessageBox::StandardButton impl(const QMessageBox::Icon &icon, QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); static QMessageBox::StandardButton impl(const QMessageBox::Icon &icon, QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
}; };

Loading…
Cancel
Save