Skip to content

Commit 452b3cb

Browse files
committed
Merge branch 'ios-ssl'
* ios-ssl: Stub in new SSL implemenation for Apple OS add millisecond resolution timer (HaxeFoundation#1234) update to Tracy 0.12.0 (HaxeFoundation#1231) Fix memory leaks in objects associated with thread creation. For HaxeFoundation#1223 Update StdLibs.h (HaxeFoundation#1221) Upgrade zlib to 1.3.1 (HaxeFoundation#1216) Custom stack traces (HaxeFoundation#1220)
2 parents 9c6f462 + 76f7dc3 commit 452b3cb

File tree

131 files changed

+4365
-2475
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+4365
-2475
lines changed

include/hx/HxcppMain.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,22 @@
9494
}
9595
catch (Dynamic e)
9696
{
97-
__hx_dump_stack();
98-
#ifdef HX_WIN_MAIN
99-
MessageBoxA(0, e==null() ? "null" : e->toString().__CStr(), "Error", 0);
100-
#else
101-
printf("Error : %s\n",e==null() ? "null" : e->toString().__CStr());
102-
#endif
103-
return -1;
97+
auto customStack = e->__Field(HX_CSTRING("_hx_customStack"), HX_PROP_DYNAMIC).asString();
98+
if (::hx::IsNotNull(customStack))
99+
{
100+
printf("%s\n", customStack.utf8_str());
101+
}
102+
else
103+
{
104+
__hx_dump_stack();
105+
}
106+
107+
#ifdef HX_WIN_MAIN
108+
MessageBoxA(0, e == null() ? "null" : e->toString().__CStr(), "Error", 0);
109+
#else
110+
printf("Error : %s\n", e == null() ? "null" : e->toString().__CStr());
111+
#endif
112+
return -1;
104113
}
105114
return 0;
106115
}

include/hx/StdLibs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Array<unsigned char> __hxcpp_resource_bytes(String inName);
4343
// System access
4444
Array<String> __get_args();
4545
double __time_stamp();
46+
::cpp::Int64 __time_stamp_ms();
4647

4748
HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_print_string(const String &inV);
4849
HXCPP_EXTERN_CLASS_ATTRIBUTES void __hxcpp_println_string(const String &inV);
@@ -161,7 +162,7 @@ HXCPP_EXTERN_CLASS_ATTRIBUTES String __hxcpp_utf8_string_to_char_bytes(String &i
161162

162163
// --- HashRoot ---------------------------------------------------------------------
163164

164-
HXCPP_EXTERN_CLASS_ATTRIBUTES int __root_hash_size(Dynamic *rtHash);
165+
HXCPP_EXTERN_CLASS_ATTRIBUTES int __root_hash_size(Dynamic &rtHash);
165166

166167
// --- IntHash ----------------------------------------------------------------------
167168

include/hx/TelemetryTracy.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
#define TRACY_ENABLE
99
#include <hxcpp.h>
10-
#include "../../project/thirdparty/tracy-0.11.1/tracy/TracyC.h"
11-
#include "../../project/thirdparty/tracy-0.11.1/tracy/Tracy.hpp"
10+
#include "../../project/thirdparty/tracy-0.12.0/tracy/TracyC.h"
11+
#include "../../project/thirdparty/tracy-0.12.0/tracy/Tracy.hpp"
1212

1313
#ifdef HXCPP_TRACY_MEMORY
1414
#ifdef HXCPP_GC_MOVING
@@ -30,7 +30,7 @@
3030
::hx::strbuf TracyConcat(_hx_tracy_str_buffer, TracyLine); \
3131
int TracyConcat(_hx_tracy_str_length, TracyLine); \
3232
const char *TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine) = name.utf8_str(&TracyConcat(_hx_tracy_str_buffer, TracyLine), false, &TracyConcat(_hx_tracy_str_length, TracyLine)); \
33-
::tracy::ScopedZone TracyConcat(_hx_tracy_scoped_zone,TracyLine)(_hx_stackframe.lineNumber, _hx_stackframe.position->fileName, strlen(_hx_stackframe.position->fileName), _hx_stackframe.position->fullName, strlen(_hx_stackframe.position->fullName), TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine), TracyConcat(_hx_tracy_str_length, TracyLine));
33+
::tracy::ScopedZone TracyConcat(_hx_tracy_scoped_zone,TracyLine)(_hx_stackframe.lineNumber, _hx_stackframe.position->fileName, strlen(_hx_stackframe.position->fileName), _hx_stackframe.position->fullName, strlen(_hx_stackframe.position->fullName), TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine), TracyConcat(_hx_tracy_str_length, TracyLine), -1);
3434
#endif
3535

3636
void __hxcpp_tracy_framemark();

include/hx/Thread.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ inline bool HxCreateDetachedThread(DWORD (WINAPI *func)(void *), void *param)
8686

8787
struct HxMutex
8888
{
89+
bool mValid;
90+
pthread_mutex_t *mMutex;
91+
8992
HxMutex()
9093
{
9194
pthread_mutexattr_t mta;
@@ -96,9 +99,7 @@ struct HxMutex
9699
}
97100
~HxMutex()
98101
{
99-
if (mValid)
100-
pthread_mutex_destroy(mMutex);
101-
delete mMutex;
102+
Clean();
102103
}
103104
void Lock() { pthread_mutex_lock(mMutex); }
104105
void Unlock() { pthread_mutex_unlock(mMutex); }
@@ -107,12 +108,16 @@ struct HxMutex
107108
void Clean()
108109
{
109110
if (mValid)
111+
{
110112
pthread_mutex_destroy(mMutex);
111-
mValid = 0;
113+
mValid = false;
114+
}
115+
if (mMutex)
116+
{
117+
delete mMutex;
118+
mMutex = nullptr;
119+
}
112120
}
113-
114-
bool mValid;
115-
pthread_mutex_t *mMutex;
116121
};
117122

118123
#define THREAD_FUNC_TYPE void *
@@ -198,19 +203,20 @@ struct HxSemaphore
198203

199204
struct HxSemaphore
200205
{
206+
HxMutex mMutex;
207+
pthread_cond_t *mCondition;
208+
bool mSet;
209+
210+
201211
HxSemaphore()
202212
{
203213
mSet = false;
204-
mValid = true;
205214
mCondition = new pthread_cond_t();
206215
pthread_cond_init(mCondition,0);
207216
}
208217
~HxSemaphore()
209218
{
210-
if (mValid)
211-
{
212-
pthread_cond_destroy(mCondition);
213-
}
219+
Clean();
214220
}
215221
// For autolock
216222
inline operator HxMutex &() { return mMutex; }
@@ -294,19 +300,14 @@ struct HxSemaphore
294300
void Clean()
295301
{
296302
mMutex.Clean();
297-
if (mValid)
303+
if (mCondition)
298304
{
299-
mValid = false;
300305
pthread_cond_destroy(mCondition);
306+
delete mCondition;
307+
mCondition = nullptr;
301308
}
302-
delete mCondition;
303309
}
304310

305-
306-
HxMutex mMutex;
307-
pthread_cond_t *mCondition;
308-
bool mSet;
309-
bool mValid;
310311
};
311312

312313

0 commit comments

Comments
 (0)