summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-30 19:32:27 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-30 19:32:34 +0300
commitac25aecfd65f1e68677ca93e0f26138fd9dc6f3e (patch)
treed3498baa7c5230208a127bd9c986bec0b42d260d /src/mir_app
parentac42d6d50636db69e56623b4b8093a5993c829d1 (diff)
fix for occasional crash
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/miranda.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp
index 089393135d..baf7bf989b 100644
--- a/src/mir_app/src/miranda.cpp
+++ b/src/mir_app/src/miranda.cpp
@@ -111,16 +111,19 @@ static void __cdecl compactHeapsThread(void*)
Thread_SetName("compactHeapsThread");
while (!Miranda_IsTerminated()) {
- HANDLE hHeaps[256];
- DWORD hc;
SleepEx((1000 * 60) * 5, TRUE); // every 5 minutes
- hc = GetProcessHeaps(255, (PHANDLE)&hHeaps);
+
+ HANDLE hHeaps[256];
+ DWORD hc = GetProcessHeaps(255, (PHANDLE)&hHeaps);
if (hc != 0 && hc < 256) {
- DWORD j;
- for (j = 0; j < hc; j++)
- HeapCompact(hHeaps[j], 0);
+ __try {
+ for (DWORD j = 0; j < hc; j++)
+ HeapCompact(hHeaps[j], 0);
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER)
+ {}
}
- } //while
+ }
}
void(*SetIdleCallback) (void) = nullptr;