Skip to content

Commit

Permalink
Update OGDebugServer API to fix retain/release crash issue (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Mar 28, 2024
1 parent 7749fd0 commit 695b7a0
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

#include "AGBase.h"

typedef struct AG_BRIDGED_TYPE(id) AGDebugServerStorage * AGDebugServerRef;

struct AGDebugServerStorage;

#if TARGET_OS_DARWIN

AG_ASSUME_NONNULL_BEGIN

typedef struct AGDebugServerStorage AGDebugServerStorage;

typedef const AGDebugServerStorage *AGDebugServer AG_SWIFT_STRUCT;

// MARK: - Exported C functions

AG_EXTERN_C_BEGIN
AG_EXPORT
AGDebugServerRef _Nullable AGDebugServerStart(unsigned int mode) AG_SWIFT_NAME(AGDebugServer.start(mode:));
AGDebugServer _Nullable AGDebugServerStart(unsigned int mode) AG_SWIFT_NAME(AGDebugServer.start(mode:));
AG_EXPORT
void AGDebugServerStop(void) AG_SWIFT_NAME(AGDebugServer.stop());
AG_EXPORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

#include "AGBase.h"

typedef struct AG_BRIDGED_TYPE(id) AGDebugServerStorage * AGDebugServerRef;

struct AGDebugServerStorage;

#if TARGET_OS_DARWIN

AG_ASSUME_NONNULL_BEGIN

typedef struct AGDebugServerStorage AGDebugServerStorage;

typedef const AGDebugServerStorage *AGDebugServer AG_SWIFT_STRUCT;

// MARK: - Exported C functions

AG_EXTERN_C_BEGIN
AG_EXPORT
AGDebugServerRef _Nullable AGDebugServerStart(unsigned int mode) AG_SWIFT_NAME(AGDebugServer.start(mode:));
AGDebugServer _Nullable AGDebugServerStart(unsigned int mode) AG_SWIFT_NAME(AGDebugServer.start(mode:));
AG_EXPORT
void AGDebugServerStop(void) AG_SWIFT_NAME(AGDebugServer.stop());
AG_EXPORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

#include "AGBase.h"

typedef struct AG_BRIDGED_TYPE(id) AGDebugServerStorage * AGDebugServerRef;

struct AGDebugServerStorage;

#if TARGET_OS_DARWIN

AG_ASSUME_NONNULL_BEGIN

typedef struct AGDebugServerStorage AGDebugServerStorage;

typedef const AGDebugServerStorage *AGDebugServer AG_SWIFT_STRUCT;

// MARK: - Exported C functions

AG_EXTERN_C_BEGIN
AG_EXPORT
AGDebugServerRef _Nullable AGDebugServerStart(unsigned int mode) AG_SWIFT_NAME(AGDebugServer.start(mode:));
AGDebugServer _Nullable AGDebugServerStart(unsigned int mode) AG_SWIFT_NAME(AGDebugServer.start(mode:));
AG_EXPORT
void AGDebugServerStop(void) AG_SWIFT_NAME(AGDebugServer.stop());
AG_EXPORT
Expand Down
10 changes: 5 additions & 5 deletions AG/Sources/Headers/AGDebugServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

#include "AGBase.h"

typedef struct AG_BRIDGED_TYPE(id) AGDebugServerStorage * AGDebugServerRef;

struct AGDebugServerStorage;

#if TARGET_OS_DARWIN

AG_ASSUME_NONNULL_BEGIN

typedef struct AGDebugServerStorage AGDebugServerStorage;

typedef const AGDebugServerStorage *AGDebugServer AG_SWIFT_STRUCT;

// MARK: - Exported C functions

AG_EXTERN_C_BEGIN
AG_EXPORT
AGDebugServerRef _Nullable AGDebugServerStart(unsigned int mode) AG_SWIFT_NAME(AGDebugServer.start(mode:));
AGDebugServer _Nullable AGDebugServerStart(unsigned int mode) AG_SWIFT_NAME(AGDebugServer.start(mode:));
AG_EXPORT
void AGDebugServerStop(void) AG_SWIFT_NAME(AGDebugServer.stop());
AG_EXPORT
Expand Down
4 changes: 2 additions & 2 deletions Sources/_OpenGraph/Debug/OGDebugServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

// MARK: - Exported C functions

OGDebugServerRef _Nullable OGDebugServerStart(unsigned int port) {
return (OGDebugServerRef)OG::DebugServer::start(port);
OGDebugServer _Nullable OGDebugServerStart(unsigned int port) {
return (OGDebugServer)OG::DebugServer::start(port);
}

void OGDebugServerStop() {
Expand Down
10 changes: 5 additions & 5 deletions Sources/_OpenGraph/Debug/OGDebugServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

#include "OGBase.h"

typedef struct OG_BRIDGED_TYPE(id) OGDebugServerStorage * OGDebugServerRef;

struct OGDebugServerStorage;

#if OG_TARGET_OS_DARWIN

OG_ASSUME_NONNULL_BEGIN

typedef struct OGDebugServerStorage OGDebugServerStorage;

typedef const OGDebugServerStorage *OGDebugServer OG_SWIFT_STRUCT;

// MARK: - Exported C functions

OG_EXTERN_C_BEGIN
OG_EXPORT
OGDebugServerRef _Nullable OGDebugServerStart(unsigned int mode) OG_SWIFT_NAME(OGDebugServer.start(mode:));
OGDebugServer _Nullable OGDebugServerStart(unsigned int mode) OG_SWIFT_NAME(OGDebugServer.start(mode:));
OG_EXPORT
void OGDebugServerStop(void) OG_SWIFT_NAME(OGDebugServer.stop());
OG_EXPORT
Expand Down
4 changes: 2 additions & 2 deletions Sources/_OpenGraph/Debug/og-debug-server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class DebugServer {
};
} /* OG */

struct OGDebugServerStorage {
typedef struct OGDebugServerStorage {
OG::DebugServer debugServer;
};
} OGDebugServerStorage;


OG_ASSUME_NONNULL_END
Expand Down

0 comments on commit 695b7a0

Please sign in to comment.