Make android save more robust

This commit is contained in:
Yousef Khadadeh 2026-05-17 22:18:53 +03:00
parent 3ba403f30e
commit e8cba9dc15
14 changed files with 61 additions and 33 deletions

View file

@ -49,6 +49,7 @@ jstring string2jstring(JNIEnv* env, const std::string& s) {
namespace AndroidJNICalls {
InputManager* globalInputManager;
std::mutex globalMutex;
std::mutex textboxMutex;
CustomEvents::InputTextBoxID textboxID = 0;
@ -345,4 +346,12 @@ Java_com_erroratline0_infinipaint_InfiniPaintNetworkService_networkServiceDestro
NetThreadManager::get().destroy_thread();
}
#endif
extern "C"
JNIEXPORT void JNICALL
Java_com_erroratline0_infinipaint_InfiniPaint_androidOnStop(JNIEnv *env, jclass clazz) {
std::scoped_lock a{globalMutex};
if(AndroidJNICalls::globalInputManager)
AndroidJNICalls::globalInputManager->main.input_android_on_stop_callback();
}
#endif