summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJason Barron <jason.barron@nokia.com>2010-10-29 07:40:00 (GMT)
committerJason Barron <jason.barron@nokia.com>2010-10-29 12:29:11 (GMT)
commite78a4b092c86e56099dbed3c3f423028506129d5 (patch)
tree0e9c4369a03070a503153a1099f0b3c6554679ba /src/gui
parent7955c4351e163a98d78cf419b44ab6ce231cb6dc (diff)
downloadQt-e78a4b092c86e56099dbed3c3f423028506129d5.zip
Qt-e78a4b092c86e56099dbed3c3f423028506129d5.tar.gz
Qt-e78a4b092c86e56099dbed3c3f423028506129d5.tar.bz2
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
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp11
1 files changed, 11 insertions, 0 deletions
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<TInt32 *>(event->EventData());
+ if (data[0] == EApaSystemEventShutdown && data[1] == KGoomMemoryLowEvent)
+ return 1;
+ }
+ break;
+#endif
default:
break;
}