rive-app / rive-ios

iOS runtime for Rive
MIT License
515 stars 58 forks source link

Crash when RiveRendererView is resized to 0,0 #333

Closed molind closed 3 months ago

molind commented 3 months ago

Description

Application crash on orientation change. When app is moved from portrait to landscape there is no place for animation and it's resized to the size 0,0. After that it crashes

OS Version: iOS 17.5.1 (21F90)
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Crashed Thread: 0

Application Specific Information:
-[MTLTextureDescriptorInternal validateWithDevice:] > -[MTLTextureDescriptorInternal validateWithDevice:]:1357: failed assertion `Texture Descriptor Validation
MTLTextureDescriptor has height of zero.
'
 > error > Texture Descriptor Validation
MTLTextureDescriptor has height of zero.

Thread 0 Crashed:
0   libsystem_kernel.dylib          0x3c0d8642c         __pthread_kill
1   libsystem_pthread.dylib         0x3e88c9c0c         pthread_kill
2   libsystem_c.dylib               0x33ea63ba0         abort
3   libsystem_c.dylib               0x33ea62eac         __assert_rtn
4   Metal                           0x32e436aa4         <redacted>
5   Metal                           0x32e2ddd84         MTLReportFailure
6   Metal                           0x32e2dd6b0         _MTLMessageContextEnd
7   Metal                           0x32e2dc748         <redacted>
8   AGXMetalA14                     0x46e17b094         <redacted>
9   RiveRuntime                     0x10580abd0         rive::pls::make_pls_memoryless_texture
10  RiveRuntime                     0x10580aa58         rive::pls::PLSRenderTargetMetal::PLSRenderTargetMetal
11  RiveRuntime                     0x10580ad38         rive::pls::PLSRenderContextMetalImpl::makeRenderTarget
12  RiveRuntime                     0x1056674a4         -[RiveRendererContext beginFrame:]
13  RiveRuntime                     0x105664b40         -[RiveRendererView drawInRect:withCompletion:]
14  RiveRuntime                     0x105664c74         -[RiveRendererView drawRect:]

Provide a Repro

It's easy to reproduce. I can write a simple code for you.

Source .riv/.rev file

It will crash with any .riv

Expected behavior

It shouldn't crash.

Device & Versions (please complete the following information)

dskuza commented 3 months ago

@molind which version of the iOS runtime are you using?

molind commented 3 months ago

6.0.0Sent from my iPhoneOn 12 Aug 2024, at 16:14, David Skuza @.***> wrote: @molind which version of the iOS runtime are you using?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

molind commented 3 months ago

6.0.0

dskuza commented 3 months ago

@molind I'm unfortunately unable to reproduce this locally using various .riv files and rotations, both in simulator and on-device. Would you be able to share some sample code and an example .riv file that showcases the issue?

dskuza commented 3 months ago

@molind Can you try v6.0.2? I've just gone ahead and created it.

molind commented 3 months ago

@dskuza Checked on v6.0.3. Fixed. 🎉