[poppler] cpp/poppler-image.cpp qt5/src
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Nov 29 13:51:44 UTC 2019
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 <aacid at kde.org>
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 <pino at kde.org>
* Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
- * Copyright (C) 2017, 2018, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2017-2019, Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2017, Jeroen Ooms <jeroenooms at gmail.com>
* Copyright (C) 2018, Zsombor Hollay-Horvath <hollay.horvath at gmail.com>
* Copyright (C) 2018, Adam Reichold <adam.reichold at t-online.de>
@@ -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;
More information about the poppler
mailing list