From 297a98e065d38e805ca5d2df7a52d4f70a650cbb Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Tue, 24 May 2011 18:37:45 -0400 Subject: [PATCH] Handle leak notice now prints to error log (as well as fatal) (bug 4929, r=dvander). --- core/HandleSys.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/HandleSys.cpp b/core/HandleSys.cpp index d139c1c5..133c054d 100644 --- a/core/HandleSys.cpp +++ b/core/HandleSys.cpp @@ -987,6 +987,10 @@ bool HandleSystem::InitAccessDefaults(TypeAccess *pTypeAccess, HandleAccess *pHa return true; } +#define HANDLE_LOG_VERY_BAD(message, ...) \ + g_Logger.LogFatal(message, ##__VA_ARGS__); \ + g_Logger.LogError(message, ##__VA_ARGS__); + bool HandleSystem::TryAndFreeSomeHandles() { IPluginIterator *pl_iter = g_PluginSys.GetPluginIterator(); @@ -1032,9 +1036,9 @@ bool HandleSystem::TryAndFreeSomeHandles() return false; } - g_Logger.LogFatal("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename()); - g_Logger.LogFatal("[SM] Unloading plugin to free %d handles.", highest_handle_count); - g_Logger.LogFatal("[SM] Contact the author(s) of this plugin to correct this error.", highest_handle_count); + HANDLE_LOG_VERY_BAD("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")", highest_owner->GetFilename()); + HANDLE_LOG_VERY_BAD("[SM] Unloading plugin to free %d handles.", highest_handle_count); + HANDLE_LOG_VERY_BAD("[SM] Contact the author(s) of this plugin to correct this error.", highest_handle_count); highest_owner->GetBaseContext()->ThrowNativeErrorEx(SP_ERROR_MEMACCESS, "Memory leak");