Fix PVD connection

This commit is contained in:
bloeys
2022-01-17 14:41:47 +04:00
parent eb8eea6c44
commit 6fe8f6eba1
2 changed files with 3 additions and 7 deletions

View File

@ -34,7 +34,6 @@ void CPxSceneDesc_set_gravity(struct CPxSceneDesc*, struct CPxVec3);
void CPxSceneDesc_set_cpuDispatcher(struct CPxSceneDesc*, struct CPxCpuDispatcher*);
*/
import "C"
import "unsafe"
type PvdInstrumentationFlag uint32
@ -91,11 +90,9 @@ func (p *PvdTransport) Release() {
func DefaultPvdSocketTransportCreate(host string, port, timeoutMillis int) *PvdTransport {
hostCStr := C.CString(host)
defer C.free(unsafe.Pointer(hostCStr))
//This CString should NOT be freed because its stored internally. If this is freed connection to PVD will fail
p := &PvdTransport{}
p.cPvdTr = C.CPxDefaultPvdSocketTransportCreate(hostCStr, C.int(port), C.int(timeoutMillis))
p.cPvdTr = C.CPxDefaultPvdSocketTransportCreate(C.CString(host), C.int(port), C.int(timeoutMillis))
return p
}