Application: Use shared pointers

Fixes #1239
This commit is contained in:
Jonas Kvinge
2023-07-21 05:55:24 +02:00
parent d6b53f78ab
commit 2e61235403
316 changed files with 2170 additions and 1643 deletions

View File

@@ -43,9 +43,12 @@
#include <QSettings>
#include "core/logging.h"
#include "core/shared_ptr.h"
#include "core/signalchecker.h"
#include "transcoder.h"
using std::make_shared;
int Transcoder::JobFinishedEvent::sEventType = -1;
TranscoderPreset::TranscoderPreset(const Song::FileType filetype, const QString &name, const QString &extension, const QString &codec_mimetype, const QString &muxer_mimetype)
@@ -418,7 +421,7 @@ void Transcoder::JobState::ReportError(GstMessage *msg) const {
bool Transcoder::StartJob(const Job &job) {
std::shared_ptr<JobState> state = std::make_shared<JobState>(job, this);
SharedPtr<JobState> state = make_shared<JobState>(job, this);
emit LogLine(tr("Starting %1").arg(QDir::toNativeSeparators(job.input)));
@@ -529,7 +532,7 @@ void Transcoder::Cancel() {
// Stop the running ones
JobStateList::iterator it = current_jobs_.begin();
while (it != current_jobs_.end()) {
std::shared_ptr<JobState> state(*it);
SharedPtr<JobState> state(*it);
// Remove event handlers from the gstreamer pipeline, so they don't get called after the pipeline is shutting down
gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(state->pipeline_)), nullptr, nullptr, nullptr);

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <memory>
#include <glib.h>
#include <glib-object.h>
#include <gst/gst.h>
@@ -37,6 +36,7 @@
#include <QString>
#include <QEvent>
#include "core/shared_ptr.h"
#include "core/song.h"
struct TranscoderPreset {
@@ -140,7 +140,7 @@ class Transcoder : public QObject {
static GstBusSyncReply BusCallbackSync(GstBus*, GstMessage *msg, gpointer data);
private:
using JobStateList = QList<std::shared_ptr<JobState>>;
using JobStateList = QList<SharedPtr<JobState>>;
int max_threads_;
QList<Job> queued_jobs_;