Skip to content

Commit

Permalink
Convert the use of player_ctx in mythtranscode to QPointer<>
Browse files Browse the repository at this point in the history
We have far too many places in the transcode code path that delete player_ctx
and return.  Unfortunately, freeing "transcode" also will try to delee
player_ctx, but it's already deleted, and not nulled out.  Rather than putting
many instances of "player_ctx = NULL", I opted to make PlayerContext a
QObject, and then just use QPointer<PlayerContext> as this will clear itself
to NULL as soon as it is destroyed.

Fixes #10616
  • Loading branch information
Beirdo committed Apr 18, 2012
1 parent 9839dd7 commit c5a9262
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion mythtv/libs/libmythtv/playercontext.h
Expand Up @@ -11,6 +11,7 @@ using namespace std;
#include <QMutex>
#include <QHash>
#include <QRect>
#include <QObject>
#include "mythtvexp.h"
#include "mythdeque.h"
#include "tv.h"
Expand Down Expand Up @@ -42,8 +43,9 @@ typedef enum
typedef deque<QString> StringDeque;
typedef QHash<QString,QString> InfoMap;

class MTV_PUBLIC PlayerContext
class MTV_PUBLIC PlayerContext : public QObject
{
Q_OBJECT
public:
PlayerContext(const QString &inUseID = QString("Unknown"));
~PlayerContext();
Expand Down
5 changes: 3 additions & 2 deletions mythtv/programs/mythtranscode/transcode.h
@@ -1,9 +1,10 @@
#include <QPointer>
#include "recordingprofile.h"
#include "fifowriter.h"
#include "transcodedefs.h"
#include "programtypes.h"
#include "playercontext.h"

class PlayerContext;
class ProgramInfo;
class NuppelVideoRecorder;
class MythPlayer;
Expand Down Expand Up @@ -49,7 +50,7 @@ class Transcode : public QObject
int keyframedist;
NuppelVideoRecorder *nvr;
MythPlayer *player;
PlayerContext *player_ctx;
QPointer<PlayerContext> player_ctx;
RingBuffer *inRingBuffer;
RingBuffer *outRingBuffer;
FIFOWriter *fifow;
Expand Down

0 comments on commit c5a9262

Please sign in to comment.