mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
[FS9] Fix double deletion of CFs9Host
CFs9Host was guarded by a QSharedPointer plus it had a QObject parent.
This commit is contained in:
committed by
Mat Sutcliffe
parent
23c41a408b
commit
f60a44ea1e
@@ -30,7 +30,7 @@ namespace BlackSimPlugin
|
||||
return cats;
|
||||
}
|
||||
|
||||
CDirectPlayPeer::CDirectPlayPeer(QObject *parent, const CCallsign &callsign)
|
||||
CDirectPlayPeer::CDirectPlayPeer(const CCallsign &callsign, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_callsign(callsign),
|
||||
m_callbackWrapper(this, &CDirectPlayPeer::directPlayMessageHandler)
|
||||
@@ -151,17 +151,17 @@ namespace BlackSimPlugin
|
||||
break;
|
||||
}
|
||||
case DPN_MSGID_CONNECT_COMPLETE:
|
||||
{
|
||||
const PDPNMSG_CONNECT_COMPLETE connectCompleteMsg = static_cast<PDPNMSG_CONNECT_COMPLETE>(msgBuffer);
|
||||
if (connectCompleteMsg->hResultCode == DPN_OK)
|
||||
{
|
||||
emit connectionComplete();
|
||||
const PDPNMSG_CONNECT_COMPLETE connectCompleteMsg = static_cast<PDPNMSG_CONNECT_COMPLETE>(msgBuffer);
|
||||
if (connectCompleteMsg->hResultCode == DPN_OK)
|
||||
{
|
||||
emit connectionComplete();
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).warning(u"DirectPlay connection returned: %1") << connectCompleteMsg->hResultCode;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).warning(u"DirectPlay connection returned: %1") << connectCompleteMsg->hResultCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Directx9 SDK: Unless otherwise noted, this function should return S_OK.
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "hostnode.h"
|
||||
#include "callbackwrapper.h"
|
||||
#include "blackmisc/aviation/callsign.h"
|
||||
#include "blackmisc/worker.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
@@ -38,7 +37,7 @@ namespace BlackSimPlugin
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
CDirectPlayPeer(QObject *parent, const BlackMisc::Aviation::CCallsign &callsign);
|
||||
CDirectPlayPeer(const BlackMisc::Aviation::CCallsign &callsign, QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CDirectPlayPeer() override;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BlackSimPlugin
|
||||
CFs9Client::CFs9Client(const CSimulatedAircraft &remoteAircraft,
|
||||
const CTime &updateInterval,
|
||||
CInterpolationLogger *logger, ISimulator *simulator) :
|
||||
CDirectPlayPeer(simulator, remoteAircraft.getCallsign()),
|
||||
CDirectPlayPeer(remoteAircraft.getCallsign(), simulator),
|
||||
m_remoteAircraft(remoteAircraft),
|
||||
m_updateInterval(updateInterval),
|
||||
m_interpolator(remoteAircraft.getCallsign(), simulator, simulator, simulator->getRemoteAircraftProvider(), logger),
|
||||
@@ -296,15 +296,15 @@ namespace BlackSimPlugin
|
||||
|
||||
DPNHANDLE asyncOpHandle;
|
||||
hr = m_directPlayPeer->Connect(&dpAppDesc,
|
||||
m_hostAddress,
|
||||
m_deviceAddress,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr, 0,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&asyncOpHandle,
|
||||
0);
|
||||
m_hostAddress,
|
||||
m_deviceAddress,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr, 0,
|
||||
nullptr,
|
||||
nullptr,
|
||||
&asyncOpHandle,
|
||||
0);
|
||||
if (!isPending(hr) && isFailure(hr)) { return logDirectPlayError(hr); }
|
||||
return hr;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace BlackSimPlugin
|
||||
{
|
||||
namespace Fs9
|
||||
{
|
||||
CFs9Host::CFs9Host(QObject *owner) :
|
||||
CDirectPlayPeer(owner, sApp->swiftVersionString())
|
||||
CFs9Host::CFs9Host(QObject *parent) :
|
||||
CDirectPlayPeer(sApp->swiftVersionString(), parent)
|
||||
{
|
||||
initDirectPlay();
|
||||
createHostAddress();
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace BlackSimPlugin
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
CFs9Host(QObject *owner);
|
||||
CFs9Host(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CFs9Host() override;
|
||||
|
||||
@@ -553,7 +553,7 @@ namespace BlackSimPlugin
|
||||
|
||||
CSimulatorFs9Factory::CSimulatorFs9Factory(QObject *parent) :
|
||||
QObject(parent),
|
||||
m_fs9Host(new CFs9Host(this), cleanupFs9Host),
|
||||
m_fs9Host(new CFs9Host, cleanupFs9Host),
|
||||
m_lobbyClient(new CLobbyClient, cleanupLobbyClient)
|
||||
{
|
||||
registerMetadata();
|
||||
|
||||
Reference in New Issue
Block a user