linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #00321
[Branch ~linuxdcpp-team/linuxdcpp/trunk] Rev 344: Remote crash when user downloads from merged share
------------------------------------------------------------
revno: 344
author: Jacek Sieka <arnetheduck@xxxxxxxxx>
committer: Steven Sheehy <steven.sheehy@xxxxxxxxx>
branch nick: trunk
timestamp: Sun 2009-12-27 16:03:53 -0600
message:
Remote crash when user downloads from merged share
modified:
dcpp/ShareManager.cpp
dcpp/ShareManager.h
--
lp:linuxdcpp
https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk
Your team LinuxDC++ Team is subscribed to branch lp:linuxdcpp.
To unsubscribe from this branch go to https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk/+edit-subscription.
=== modified file 'dcpp/ShareManager.cpp'
--- dcpp/ShareManager.cpp 2009-08-21 06:37:06 +0000
+++ dcpp/ShareManager.cpp 2009-12-27 22:03:53 +0000
@@ -467,6 +467,7 @@
dcdebug("File named the same as directory");
} else {
directories.insert(std::make_pair(subSource->getName(), subSource));
+ subSource->parent = this;
}
} else {
Directory::Ptr subTarget = ti->second;
@@ -482,7 +483,10 @@
if(directories.find(i->getName()) != directories.end()) {
dcdebug("Directory named the same as file");
} else {
- files.insert(*i);
+ std::pair<File::Set::iterator, bool> added = files.insert(*i);
+ if(added.second) {
+ const_cast<File&>(*added.first).setParent(this);
+ }
}
}
}
=== modified file 'dcpp/ShareManager.h'
--- dcpp/ShareManager.h 2009-08-21 06:37:06 +0000
+++ dcpp/ShareManager.h 2009-12-27 22:03:53 +0000
@@ -127,7 +127,7 @@
typedef set<File, FileLess> Set;
File() : size(0), parent(0) { }
- File(const string& aName, int64_t aSize, Directory::Ptr aParent, const TTHValue& aRoot) :
+ File(const string& aName, int64_t aSize, const Directory::Ptr& aParent, const TTHValue& aRoot) :
name(aName), tth(aRoot), size(aSize), parent(aParent.get()) { }
File(const File& rhs) :
name(rhs.getName()), tth(rhs.getTTH()), size(rhs.getSize()), parent(rhs.getParent()) { }