mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-11 02:28:51 +00:00
Common/TraversalClient: Use correct deleter with g_MainNetHost
Previously this was using the default deleter (which just calls delete on the pointer), which is incorrect, since the ENetHost instance is allocated through ENet's C API, so we need to use its functions to deallocate the host instead.
This commit is contained in:
parent
6d8cabac49
commit
b4cc1ade02
3 changed files with 17 additions and 9 deletions
|
@ -3,14 +3,21 @@
|
|||
//
|
||||
#pragma once
|
||||
|
||||
#include <enet/enet.h>
|
||||
#include <memory>
|
||||
|
||||
#include <SFML/Network/Packet.hpp>
|
||||
#include <enet/enet.h>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
namespace Common::ENet
|
||||
{
|
||||
struct ENetHostDeleter
|
||||
{
|
||||
void operator()(ENetHost* host) const noexcept { enet_host_destroy(host); }
|
||||
};
|
||||
using ENetHostPtr = std::unique_ptr<ENetHost, ENetHostDeleter>;
|
||||
|
||||
void WakeupThread(ENetHost* host);
|
||||
int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event);
|
||||
bool SendPacket(ENetPeer* socket, const sf::Packet& packet, u8 channel_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue