1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
Description: Fix segfault in podbeuter when downloading podcasts
Origin: upstream, https://github.com/akrennmair/newsbeuter/pull/168
Bug: https://github.com/akrennmair/newsbeuter/issues/167
--- a/include/poddlthread.h
+++ b/include/poddlthread.h
@@ -7,6 +7,7 @@
#include <sys/time.h>
#include <time.h>
+#include <memory>
#include <configcontainer.h>
@@ -24,7 +25,7 @@
private:
void mkdir_p(const char * file);
download * dl;
- std::ofstream *f;
+ std::shared_ptr<std::ofstream> f;
timeval tv1;
timeval tv2;
size_t bytecount;
--- a/src/pb_controller.cpp
+++ b/src/pb_controller.cpp
@@ -287,6 +287,7 @@
if (it->status() == DL_QUEUED) {
std::thread t {poddlthread(&(*it), cfg)};
--dl2start;
+ t.detach();
}
}
}
--- a/src/pb_view.cpp
+++ b/src/pb_view.cpp
@@ -111,6 +111,7 @@
if (idx != -1) {
if (ctrl->downloads()[idx].status() != DL_DOWNLOADING) {
std::thread t {poddlthread(&ctrl->downloads()[idx], ctrl->get_cfgcont())};
+ t.detach();
}
}
}
--- a/src/poddlthread.cpp
+++ b/src/poddlthread.cpp
@@ -22,7 +22,6 @@
}
poddlthread::~poddlthread() {
- delete f;
}
void poddlthread::operator()() {
|