From e78a4b092c86e56099dbed3c3f423028506129d5 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Fri, 29 Oct 2010 09:40:00 +0200 Subject: Avoid being killed by graphics out-of-memory monitor. When an application requests more graphics memory, the GOOM monitor will start looking for other applications to kill in order to recover the requested graphics memory. The first step in this process is to send a custom event to the application indicating that it is a candidate for termination. If the application does not acknowledge this event, it will be killed immediately. However, since Qt releases its graphics memory when the app is obscured, we should indicate that we handle this event such that Qt has a chance to finish freeing resources. If after a certain time, the app has not freed its resources it will be killed anyway. This essentially buys Qt some time to avoid the case where Qt apps are killed while they are cleaning up. Task: QTBUG-14858 Reviewed-by: Jani Hautakangas --- src/gui/kernel/qapplication_s60.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 5ff2fd4..ae7070e 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -2055,6 +2055,17 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent } #endif break; +#ifdef Q_SYMBIAN_SUPPORTS_SURFACES + case EEventUser: + { + // GOOM is looking for candidates to kill so indicate that we are + // capable of cleaning up by handling this event + TInt32 *data = reinterpret_cast(event->EventData()); + if (data[0] == EApaSystemEventShutdown && data[1] == KGoomMemoryLowEvent) + return 1; + } + break; +#endif default: break; } -- cgit v0.12