mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:49:34 +02:00
fix crash by closing socket before deleting audio data
This commit is contained in:
parent
52c410a65d
commit
b3375c5e5f
3 changed files with 7 additions and 1 deletions
|
@ -39,6 +39,7 @@ AudioData::~AudioData() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
delete[] samplesToQueue;
|
delete[] samplesToQueue;
|
||||||
|
|
||||||
|
delete audioSocket;
|
||||||
}
|
}
|
|
@ -51,6 +51,10 @@ UDPSocket::UDPSocket(int listeningPort) {
|
||||||
printf("Created UDP socket listening on port %d.\n", listeningPort);
|
printf("Created UDP socket listening on port %d.\n", listeningPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UDPSocket::~UDPSocket() {
|
||||||
|
close(handle);
|
||||||
|
}
|
||||||
|
|
||||||
bool UDPSocket::receive(void *receivedData, int *receivedBytes) {
|
bool UDPSocket::receive(void *receivedData, int *receivedBytes) {
|
||||||
|
|
||||||
*receivedBytes = recvfrom(handle, receivedData, MAX_BUFFER_LENGTH_BYTES,
|
*receivedBytes = recvfrom(handle, receivedData, MAX_BUFFER_LENGTH_BYTES,
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
class UDPSocket {
|
class UDPSocket {
|
||||||
public:
|
public:
|
||||||
UDPSocket(int listening_port);
|
UDPSocket(int listening_port);
|
||||||
|
~UDPSocket();
|
||||||
int send(char *destAddress, int destPort, const void *data, int byteLength);
|
int send(char *destAddress, int destPort, const void *data, int byteLength);
|
||||||
bool receive(void *receivedData, int *receivedBytes);
|
bool receive(void *receivedData, int *receivedBytes);
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue