From 433f871f0f6bc68fbb1fffbdac42ef1bb8b5d019 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Oct 2010 00:25:32 +0000 Subject: bugfix [#24302] Ctrl+Click Extrude gets old mouse events double click didnt check mouse distance moved so you could click twice in different areas of the screen very fast and generate a double click event which had old mouse coords copied into it but was sent to an operator set to run on single click (because the double click wasnt handled). Also added MEM_name_ptr function (included in debug mode only), prints the name of allocated memory. used for debugging where events came from. --- intern/guardedalloc/MEM_guardedalloc.h | 4 ++++ intern/guardedalloc/intern/mallocn.c | 14 ++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'intern/guardedalloc') diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 6b78b0b6bdc..dfb8b2db1b1 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -150,6 +150,10 @@ extern "C" { /*get the peak memory usage in bytes, including mmap allocations*/ uintptr_t MEM_get_peak_memory(void); +#ifndef NDEBUG +const char *MEM_name_ptr(void *vmemh); +#endif + #ifdef __cplusplus } #endif diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c index 09f2d33a674..b213a1c3744 100644 --- a/intern/guardedalloc/intern/mallocn.c +++ b/intern/guardedalloc/intern/mallocn.c @@ -856,4 +856,18 @@ int MEM_get_memory_blocks_in_use(void) return _totblock; } +#ifndef NDEBUG +const char *MEM_name_ptr(void *vmemh) +{ + if (vmemh) { + MemHead *memh= vmemh; + memh--; + return memh->name; + } + else { + return "MEM_name_ptr(NULL)"; + } +} +#endif + /* eof */ -- cgit v1.2.3