diff --git a/source/lib/res/graphics/tex.cpp b/source/lib/res/graphics/tex.cpp index 6bd6665571..be6ded1d90 100755 --- a/source/lib/res/graphics/tex.cpp +++ b/source/lib/res/graphics/tex.cpp @@ -497,9 +497,6 @@ int tex_wrap(uint w, uint h, uint bpp, uint flags, void* img, Tex* t) void* reported_ptr = mem_get_ptr(t->hm); t->ofs = (u8*)img - (u8*)reported_ptr; - // TODO: remove when mem_wrap / mem_get_ptr add a reference correctly - h_add_ref(t->hm); - CHECK_TEX(t); return 0; } diff --git a/source/lib/res/mem.cpp b/source/lib/res/mem.cpp index 530b0d2ce2..d44e9a302d 100755 --- a/source/lib/res/mem.cpp +++ b/source/lib/res/mem.cpp @@ -260,10 +260,14 @@ Handle mem_wrap(void* p, size_t size, uint flags, void* raw_p, size_t raw_size, SCOPED_LOCK; - // we've already allocated that pointer - returns its handle + // we've already allocated that pointer; return its handle and + // increment refcnt. Handle hm = find_alloc(p); if(hm > 0) + { + h_add_ref(hm); return hm; + } //
wasn't allocated via mem_alloc, or we would've found its Handle.
// it is therefore some user-allocated mem and might therefore not have
diff --git a/source/lib/sysdep/win/wdbg_sym.cpp b/source/lib/sysdep/win/wdbg_sym.cpp
index 138921294f..8d7e69482f 100755
--- a/source/lib/sysdep/win/wdbg_sym.cpp
+++ b/source/lib/sysdep/win/wdbg_sym.cpp
@@ -214,6 +214,7 @@ int debug_resolve_symbol(void* ptr_of_interest, char* sym_name, char* file, int*
if(sym_name)
{
sym_name[0] = '\0';
+
SYMBOL_INFO_PACKAGEW2 sp;
SYMBOL_INFOW* sym = &sp.si;
if(SymFromAddrW(hProcess, addr, 0, sym))
@@ -226,6 +227,9 @@ int debug_resolve_symbol(void* ptr_of_interest, char* sym_name, char* file, int*
// get source file and/or line number (if requested)
if(file || line)
{
+ file[0] = '\0';
+ *line = 0;
+
IMAGEHLP_LINE64 line_info = { sizeof(IMAGEHLP_LINE64) };
DWORD displacement; // unused but required by SymGetLineFromAddr64!
if(SymGetLineFromAddr64(hProcess, addr, &displacement, &line_info))
@@ -304,6 +308,8 @@ func2:
*/
+#if CPU_IA32 && !CONFIG_OMIT_FP
+
static int ia32_walk_stack(STACKFRAME64* sf)
{
// read previous values from STACKFRAME64
@@ -338,6 +344,7 @@ static int ia32_walk_stack(STACKFRAME64* sf)
return 0;
}
+#endif // #if CPU_IA32 && !CONFIG_OMIT_FP
// called for each stack frame found by walk_stack, passing information
@@ -456,12 +463,9 @@ static int walk_stack(StackFrameCallback cb, void* user_arg = 0, uint skip = 0,
}
#endif
- void* ret_addr = (void*)(uintptr_t)sf.AddrReturn.Offset;
- void* fp = (void*)(uintptr_t)sf.AddrFrame .Offset;
- void* pc = (void*)(uintptr_t)sf.AddrPC .Offset;
-
// no more frames found - abort. note: also test FP because
// StackWalk64 sometimes erroneously reports success.
+ void* fp = (void*)(uintptr_t)sf.AddrFrame .Offset;
if(err < 0 || !fp)
return ret;
diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp
index 6cba52fb6d..f8b45c8088 100755
--- a/source/renderer/Renderer.cpp
+++ b/source/renderer/Renderer.cpp
@@ -1365,7 +1365,7 @@ bool CRenderer::IsTextureTransparent(CTexture* texture)
-inline void CopyTriple(unsigned char* dst,const unsigned char* src)
+static inline void CopyTriple(unsigned char* dst,const unsigned char* src)
{
dst[0]=src[0];
dst[1]=src[1];
@@ -1390,7 +1390,7 @@ int CRenderer::LoadAlphaMaps()
//
// load all textures and store Handle in array
//
- Handle textures[NumAlphaMaps];
+ Handle textures[NumAlphaMaps] = {0};
PathPackage pp;
(void)pp_set_dir(&pp, "art/textures/terrain/alphamaps/special");
const char* fnames[NumAlphaMaps] = {
@@ -1486,7 +1486,7 @@ int CRenderer::LoadAlphaMaps()
}
for (uint i=0;i