diff --git a/src/SFML/Main/MainAndroid.cpp b/src/SFML/Main/MainAndroid.cpp index 3378c3580..f424d23bc 100644 --- a/src/SFML/Main/MainAndroid.cpp +++ b/src/SFML/Main/MainAndroid.cpp @@ -500,9 +500,9 @@ JNIEXPORT void ANativeActivity_onCreate(ANativeActivity* activity, void* savedSt if (savedState != nullptr) { - states->savedState = std::malloc(savedStateSize); - states->savedStateSize = savedStateSize; - std::memcpy(states->savedState, savedState, savedStateSize); + const auto* begin = static_cast(savedState); + const auto* end = begin + savedStateSize; + states->savedState.assign(begin, end); } states->mainOver = false; diff --git a/src/SFML/System/Android/Activity.hpp b/src/SFML/System/Android/Activity.hpp index 8a391719e..7d981cb8f 100644 --- a/src/SFML/System/Android/Activity.hpp +++ b/src/SFML/System/Android/Activity.hpp @@ -39,6 +39,8 @@ #include #include +#include + class SFML_SYSTEM_API LogcatStream : public std::streambuf { public: @@ -64,8 +66,7 @@ struct ActivityStates EGLDisplay display{}; EglContext* context{}; - void* savedState{}; - std::size_t savedStateSize{}; + std::vector savedState; std::recursive_mutex mutex;