cpp/poppler-image.cpp | 5 ++++- qt5/src/poppler-outline.cc | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-)
New commits: commit ec2b036e0029e94183a87471c83577336bbaedda Author: Albert Astals Cid <[email protected]> Date: Fri Nov 29 14:42:31 2019 +0100 Return early in operator= if we're assigning to ourselves Makes bugprone-unhandled-self-assignment happy diff --git a/cpp/poppler-image.cpp b/cpp/poppler-image.cpp index 261c5f7b..daf10f02 100644 --- a/cpp/poppler-image.cpp +++ b/cpp/poppler-image.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2010-2011, Pino Toscano <[email protected]> * Copyright (C) 2013 Adrian Johnson <[email protected]> - * Copyright (C) 2017, 2018, Albert Astals Cid <[email protected]> + * Copyright (C) 2017-2019, Albert Astals Cid <[email protected]> * Copyright (C) 2017, Jeroen Ooms <[email protected]> * Copyright (C) 2018, Zsombor Hollay-Horvath <[email protected]> * Copyright (C) 2018, Adam Reichold <[email protected]> @@ -498,6 +498,9 @@ std::vector<std::string> image::supported_image_formats() */ image& image::operator=(const image &pt) { + if (this == &pt) + return *this; + if (pt.d) { ++pt.d->ref; } diff --git a/qt5/src/poppler-outline.cc b/qt5/src/poppler-outline.cc index dd452b47..1c7e4a3d 100644 --- a/qt5/src/poppler-outline.cc +++ b/qt5/src/poppler-outline.cc @@ -44,6 +44,9 @@ OutlineItem::OutlineItem(const OutlineItem &other) : m_data{new OutlineItemData{ OutlineItem &OutlineItem::operator=(const OutlineItem &other) { + if (this == &other) + return *this; + auto *data = new OutlineItemData{*other.m_data}; qSwap(m_data, data); delete data; _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
