Skip to content

Commit

Permalink
runtime: Fix assignment of temporary reference
Browse files Browse the repository at this point in the history
This could cause a segfault in usage.
  • Loading branch information
cassava committed Jul 25, 2022
1 parent a9160e4 commit 64cf1f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plugins/gndtruth_extractor/src/gndtruth_extractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class GndTruthSerializerImpl
typedef SequentialFileSerializer<TSerializer, TOutputStream, const Sync&, const GndTruth&> base1;

public:
GndTruthSerializerImpl(Logger& logger) : base1(logger), GndTruthSerializer() {}
GndTruthSerializerImpl(Logger logger) : base1(logger), GndTruthSerializer() {}
virtual ~GndTruthSerializerImpl() override;
using base1::open_file;
virtual void open_file(const std::string& filename) override {
Expand Down
8 changes: 4 additions & 4 deletions runtime/include/cloe/utility/output_serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ class OutputStream {
using char_iterator = std::vector<char>::iterator;
using uint8_iterator = std::vector<uint8_t>::iterator;

explicit OutputStream(Logger& logger) : logger_(logger) {}
explicit OutputStream(Logger logger) : logger_(logger) {}
virtual ~OutputStream() = default;
virtual std::string make_default_filename(const std::string& default_filename) = 0;
virtual bool open_stream() = 0;
virtual void write(const char* s, std::streamsize count) = 0;
virtual void close_stream() = 0;

protected:
Logger& logger_;
Logger logger_;
};

template <typename... TSerializerArgs>
Expand Down Expand Up @@ -106,7 +106,7 @@ class FileOutputStream : public BasicFileOutputStream {

class FilteringOutputStream : public BasicFileOutputStream {
public:
explicit FilteringOutputStream(Logger& logger)
explicit FilteringOutputStream(Logger logger)
: BasicFileOutputStream(logger), filter_(), out_(&filter_) {}
virtual ~FilteringOutputStream() = default;
bool open_file(const std::string& filename, const std::string& default_filename) override;
Expand Down Expand Up @@ -170,7 +170,7 @@ class Bzip2OutputStream : public FilteringOutputStream {
template <typename TSerializer, typename TOutputStream, typename... TSerializerArgs>
class FileSerializer {
public:
explicit FileSerializer(Logger& logger)
explicit FileSerializer(Logger logger)
: outputstream_(logger)
, serializer_((void (OutputStream::*)(const char*, std::streamsize)) & TOutputStream::write,
&outputstream_) {}
Expand Down
2 changes: 1 addition & 1 deletion runtime/include/cloe/utility/output_serializer_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class JsonFileSerializerImpl
SequentialFileSerializer<SimpleJsonSerializer, TOutputStream, const Json&, bool>;

public:
JsonFileSerializerImpl(Logger& logger) : file_base(logger), JsonFileSerializer() {}
JsonFileSerializerImpl(Logger logger) : file_base(logger), JsonFileSerializer() {}
virtual ~JsonFileSerializerImpl() = default;
using file_base::open_file;
void open_file(const std::string& filename) override {
Expand Down

0 comments on commit 64cf1f2

Please sign in to comment.