You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems like the method below (in android-activity/src/game_activity/mod.rs) takes a pointer to the NativeAppGlue (self.native_app) struct, which may be dropped before the AssetManager itself.
pub fn asset_manager(&self) -> AssetManager {
unsafe {
let app_ptr = self.native_app.as_ptr();
let am_ptr = NonNull::new_unchecked((*(*app_ptr).activity).assetManager);
AssetManager::from_ptr(am_ptr)
}
}
calling an asset manager method such as open is causing a SIGABRT with a message of FORTIFY: pthread_mutex_lock called on a destroyed mutex (0xb400007643074c50)
The text was updated successfully, but these errors were encountered:
This looks like a remnant from te horrible original ndk docs that I/we inherited. Currently AssetManager::from_ptr() says:
Create an AssetManager from a pointer
When nothing is created at all, nor is there a refcount to increment. The lifetime of this AssetManager purely depends on the input pointer, which is likely destroyed in native code.
Instead these # Safety docs should state that the caller is still responsible for managing the valid lifetime of the input pointer, and that it's simply wrapping a reference to an AssetManager.
Note that no pointer is taken "to the NativeAppGlue struct"; it's an independent pointer value that they set up for us (internally it may point to an offset within the same struct, but that's not a requirement).
Seems like the method below (in
android-activity/src/game_activity/mod.rs
) takes a pointer to theNativeAppGlue
(self.native_app) struct, which may be dropped before theAssetManager
itself.calling an asset manager method such as
open
is causing a SIGABRT with a message ofFORTIFY: pthread_mutex_lock called on a destroyed mutex (0xb400007643074c50)
The text was updated successfully, but these errors were encountered: