Replace more instances new/delete with owning types (#4245)

* Use owning types when possible.

Note: the QByteArray s is detached to mimic previous behavior;
detach() guarantees that the QByteArray uniquely owns its data, since
otherwise it's COW. This may be relevant in case Plugin:instantiate
modifies s.data() -- this way the original QString is safe.

* Make m_filter a unique_ptr.

* Make m_activeRenderer a unique_ptr

* use std::string instead of strcpy + buffers
This commit is contained in:
Colin Wallace
2018-03-15 18:46:55 -07:00
committed by GitHub
parent 80ce77fc91
commit b706ee208d
7 changed files with 29 additions and 36 deletions

View File

@@ -26,6 +26,8 @@
#ifndef NOTE_PLAY_HANDLE_H
#define NOTE_PLAY_HANDLE_H
#include <memory>
#include "AtomicInt.h"
#include "BasicFilters.h"
#include "Note.h"
@@ -46,7 +48,7 @@ class EXPORT NotePlayHandle : public PlayHandle, public Note
MM_OPERATORS
public:
void * m_pluginData;
BasicFilters<> * m_filter;
std::unique_ptr<BasicFilters<>> m_filter;
// specifies origin of NotePlayHandle
enum Origins

View File

@@ -26,7 +26,7 @@
#ifndef RENDER_MANAGER_H
#define RENDER_MANAGER_H
#include <vector>
#include <memory>
#include "ProjectRenderer.h"
#include "OutputSettings.h"
@@ -70,7 +70,7 @@ private:
ProjectRenderer::ExportFileFormats m_format;
QString m_outputPath;
ProjectRenderer* m_activeRenderer;
std::unique_ptr<ProjectRenderer> m_activeRenderer;
QVector<Track*> m_tracksToRender;
QVector<Track*> m_unmuted;