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

List:       kde-commits
Subject:    =?utf-8?q?=5Bakonadi/1=2E5=5D_server/src/handler=3A_Don=27t_cras?=
From:       Sergio Martins <iamsergio () gmail ! com>
Date:       2011-04-28 20:05:52
Message-ID: 20110428200552.BF7CFA60A4 () git ! kde ! org
[Download RAW message or body]

Git commit 826b4e9dc9dc6710d0c63c3da20509b390333ed6 by Sergio Martins.
Committed on 28/04/2011 at 23:04.
Pushed by smartins into branch '1.5'.

Don't crash when copying a folder into itself.

BUG: 271808

M  +6    -0    server/src/handler/colcopy.cpp     

http://commits.kde.org/akonadi/826b4e9dc9dc6710d0c63c3da20509b390333ed6

diff --git a/server/src/handler/colcopy.cpp b/server/src/handler/colcopy.cpp
index 2098500..ef08586 100644
--- a/server/src/handler/colcopy.cpp
+++ b/server/src/handler/colcopy.cpp
@@ -24,12 +24,18 @@
 #include "storage/datastore.h"
 #include "storage/transaction.h"
 #include "storage/itemretriever.h"
+#include "storage/collectionqueryhelper.h"
 #include "imapstreamparser.h"
 
 using namespace Akonadi;
 
 bool ColCopy::copyCollection(const Collection & source, const Collection & target)
 {
+  if ( !CollectionQueryHelper::canBeMovedTo( source, target ) ) {
+    // We don't accept source==target, or source being an ancestor of target.
+    return false;
+  }
+
   // copy the source collection
   Collection col = source;
   col.setParentId( target.id() );

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

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