mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix crash when taking screenshots on a thread
Forgot that we only enable android JNI on "I/O" threads. Fixes #20139
This commit is contained in:
parent
112bd904b8
commit
a3a7807aac
3 changed files with 3 additions and 2 deletions
|
@ -139,6 +139,7 @@ static void WorkerThreadFunc(GlobalThreadContext *global, TaskThreadContext *thr
|
|||
}
|
||||
SetCurrentThreadName(thread->name);
|
||||
|
||||
// Should we do this on all threads?
|
||||
if (thread->type == TaskType::IO_BLOCKING) {
|
||||
AttachThreadToJNI();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// To help smart scheduling.
|
||||
enum class TaskType {
|
||||
CPU_COMPUTE,
|
||||
IO_BLOCKING,
|
||||
IO_BLOCKING, // NOTE: Only these can access scoped storage on Android (they initialize the JNI context).
|
||||
DEDICATED_THREAD, // These can never get stuck in queue behind others, but are more expensive to launch. Cannot use I/O.
|
||||
};
|
||||
|
||||
|
|
|
@ -361,7 +361,7 @@ ScreenshotResult TakeGameScreenshot(Draw::DrawContext *draw, const Path &filenam
|
|||
}
|
||||
|
||||
if (callback) {
|
||||
g_threadManager.EnqueueTask(new IndependentTask(TaskType::CPU_COMPUTE, TaskPriority::LOW,
|
||||
g_threadManager.EnqueueTask(new IndependentTask(TaskType::IO_BLOCKING, TaskPriority::LOW,
|
||||
[buf = std::move(buf), callback = std::move(callback), filename, fmt, w, h]() {
|
||||
u8 *flipbuffer = nullptr;
|
||||
u32 width = w, height = h;
|
||||
|
|
Loading…
Add table
Reference in a new issue