summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderProxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/renderthread/RenderProxy.cpp')
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 3f030936185e..986e80805a00 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -336,11 +336,14 @@ CREATE_BRIDGE2(timMemory, RenderThread* thread, int level) {
}
void RenderProxy::trimMemory(int level) {
- RenderThread& thread = RenderThread::getInstance();
- SETUP_TASK(timMemory);
- args->thread = &thread;
- args->level = level;
- thread.queue(task);
+ // Avoid creating a RenderThread to do a trimMemory.
+ if (RenderThread::hasInstance()) {
+ RenderThread& thread = RenderThread::getInstance();
+ SETUP_TASK(timMemory);
+ args->thread = &thread;
+ args->level = level;
+ thread.queue(task);
+ }
}
CREATE_BRIDGE0(fence) {