[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-baseapps/frameworks] lib/konq/src: Fix clang warning (rule of three). This would have indeed cr
From:       David Faure <faure () kde ! org>
Date:       2016-02-21 12:09:45
Message-ID: E1aXSpd-0000FK-Qj () scm ! kde ! org
[Download RAW message or body]

Git commit 7d1f47da1d93482fff49ee2881ae4f8b0565fa94 by David Faure.
Committed on 21/02/2016 at 12:09.
Pushed by dfaure into branch 'frameworks'.

Fix clang warning (rule of three). This would have indeed crashed if using a d pointer one day.

M  +17   -11   lib/konq/src/konq_historyentry.cpp
M  +3    -2    lib/konq/src/konq_historyentry.h

http://commits.kde.org/kde-baseapps/7d1f47da1d93482fff49ee2881ae4f8b0565fa94

diff --git a/lib/konq/src/konq_historyentry.cpp b/lib/konq/src/konq_historyentry.cpp
index 1227ee7..8254112 100644
--- a/lib/konq/src/konq_historyentry.cpp
+++ b/lib/konq/src/konq_historyentry.cpp
@@ -30,6 +30,23 @@ KonqHistoryEntry::~KonqHistoryEntry()
 {
 }
 
+KonqHistoryEntry::KonqHistoryEntry(const KonqHistoryEntry& other)
+{
+    operator=(other);
+}
+
+KonqHistoryEntry &KonqHistoryEntry::operator=(const KonqHistoryEntry &other)
+{
+    url = other.url;
+    typedUrl = other.typedUrl;
+    title = other.title;
+    numberOfTimesVisited = other.numberOfTimesVisited;
+    firstVisited = other.firstVisited;
+    lastVisited = other.lastVisited;
+    d = 0;
+    return *this;
+}
+
 bool KonqHistoryEntry::operator==(const KonqHistoryEntry& entry) const
 {
     return url == entry.url &&
@@ -70,17 +87,6 @@ void KonqHistoryEntry::save(QDataStream& s, Flags flags) const
     s << lastVisited;
 }
 
-KonqHistoryEntry::KonqHistoryEntry(const KonqHistoryEntry& e)
-{
-    url = e.url;
-    typedUrl = e.typedUrl;
-    title = e.title;
-    numberOfTimesVisited = e.numberOfTimesVisited;
-    firstVisited = e.firstVisited;
-    lastVisited = e.lastVisited;
-    d = 0;
-}
-
 ////
 
 KonqHistoryList::iterator KonqHistoryList::findEntry( const QUrl& url )
diff --git a/lib/konq/src/konq_historyentry.h b/lib/konq/src/konq_historyentry.h
index de34d6b..480cb27 100644
--- a/lib/konq/src/konq_historyentry.h
+++ b/lib/konq/src/konq_historyentry.h
@@ -30,8 +30,11 @@ class LIBKONQ_EXPORT KonqHistoryEntry
 {
 public:
     KonqHistoryEntry();
+    KonqHistoryEntry(const KonqHistoryEntry& other);
     ~KonqHistoryEntry();
 
+    KonqHistoryEntry &operator=(const KonqHistoryEntry &entry);
+
     QUrl url;
     QString typedUrl;
     QString title;
@@ -39,8 +42,6 @@ public:
     QDateTime firstVisited;
     QDateTime lastVisited;
 
-    KonqHistoryEntry(const KonqHistoryEntry& e);
-
     // Necessary for QList (on Windows)
     bool operator==(const KonqHistoryEntry& entry) const;
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic