summarylogtreecommitdiffstats
path: root/ps-issue-515_all.patch
diff options
context:
space:
mode:
authorxsmile2017-06-07 04:53:21 +0200
committerxsmile2017-06-07 04:53:21 +0200
commit0078dc7d12680689003e566d672b700390f16587 (patch)
tree3bbcb6de83557c32b4e0eaf71825b11c8910b537 /ps-issue-515_all.patch
parentaab83aff1987dc5c2600f933bdd21181bc7eba96 (diff)
downloadaur-0078dc7d12680689003e566d672b700390f16587.tar.gz
update
Diffstat (limited to 'ps-issue-515_all.patch')
-rw-r--r--ps-issue-515_all.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/ps-issue-515_all.patch b/ps-issue-515_all.patch
new file mode 100644
index 000000000000..cd820cb22361
--- /dev/null
+++ b/ps-issue-515_all.patch
@@ -0,0 +1,29 @@
+--- a/src/rpc/command_scheduler.cc
++++ b/src/rpc/command_scheduler.cc
+@@ -63,15 +63,18 @@ CommandScheduler::insert(const std::string& key) {
+ if (key.empty())
+ throw torrent::input_error("Scheduler received an empty key.");
+
+- iterator itr = find(key);
++ CommandSchedulerItem* current = new CommandSchedulerItem(key);
++ current->slot() = std::tr1::bind(&CommandScheduler::call_item, this, current);
+
+- if (itr == end())
+- itr = base_type::insert(end(), NULL);
+- else
+- delete *itr;
+-
+- *itr = new CommandSchedulerItem(key);
+- (*itr)->slot() = std::tr1::bind(&CommandScheduler::call_item, this, *itr);
++ iterator itr = find(key);
++ if (itr == end()) {
++ itr = base_type::insert(end(), current);
++ } else {
++ // swap in fully initialized command, and THEN delete the replaced one
++ CommandSchedulerItem* old = *itr;
++ *itr = current;
++ delete old;
++ }
+
+ return itr;
+ }