setDrawOffset is crashing the playdate

I'm running this on both the simulator in macos and on the playdate console, for whatever reason calling gfx.setDrawOffset will crash the simulator/console.

I've been able to narrow it down to the gfx.setDrawOffset specifically where I can comment out that one line and everything else works as expected. Logging out the x, y values I'm passing in doesn't show anything weird either.

I don't get any error logs, it will just freeze and eventually crash.
This is what I get in the crash logs

--- crash at 2022/06/05 05:50:34---
build:5f230668fc9b-1.11.1-release.136881-buildbot
   r0:00000001    r1:00000001     r2:00045400    r3: 40012c00
  r12:00003fe0    lr:08030563     pc:08030522   psr: 21000000
 cfsr:00000000  hfsr:40000000  mmfar:00000000  bfar: 00000000
rcccsr:00000000
heap allocated: 702816
Lua totalbytes=127914665 GCdebt=-127572772 GCestimate=339345 stacksize=168

Here's a link to the line that seems to be causing the issue.
Github

How to replicate:

  • pull the repo, build and run a-balanced-breakfast
  • select the level editor
  • select new level
  • press down until you have the steepest downwards slope
  • press A 6 times
  • press left

Heres a screen recording of it happening, it's kinda hard to see but at the end I was getting the pinwheel but it wasn't showing up in the video :frowning:

Screen Recording 2022-06-05 at 4.04.42 pm.zip (5.5 MB)

I use setDrawOffset in my most recent two games without any problems.

So your issue here must run deeper.

Are you on the latest SDK? It looks like it's this problem: Infinite loop in `drawTextInRect` with narrow widths - #3 by dwineman though that was fixed in 1.10. I tested on the current 1.12 beta and it's no longer hanging, so if updating the SDK doesn't fix it, it looks like the next release will.