romainguy / pathway

A set of APIs to manipulate graphics paths on Android.
Apache License 2.0
197 stars 3 forks source link

native crash getting a segment iterator #2

Closed chethaase closed 1 year ago

chethaase commented 1 year ago

I have a simple path created with a single cubic: path.reset() path.moveTo(pathPoints[0], pathPoints[1]) path.cubicTo(points[index 2], points[index 2 + 1], points[index 2], points[index 2 + 1], points[index 2], points[index 2 + 1])

I try to log the result with pathway like so: for (segment: PathSegment in path.asAndroidPath()) { println("*** segment = $segment") } The app crashes in on hasNext() during iteration. I tried it with a close() command, and with one more cubic, but it always crashed in native code with this log: 2022-07-08 16:07:33.732 22397-22397/com.example.pathplayground A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x2 in tid 22397 (.pathplayground)

chethaase commented 1 year ago

Specifically, debugger has it crashing when stepping over this call: val typeValue = internalPathIteratorNext(internalPathIterator, pointsData) where pointsData is a float array of 8 0.0's.

romainguy commented 1 year ago

On which version of Android?

chethaase commented 1 year ago

This was on an API 24 emulator (x86). Is there a problem running it on the emulator, or on another binary platform? I wondered whether the problem wasn't a crash in that function per se, but rather a problem with the native side of pathway in general, either it's not building correctly on my system or is hitting some other incompatibility problem.

chethaase commented 1 year ago

Hm, now running API 24 emulator (ARM) on a different machine (m1 mac vs x86 mac) and it doesn't crash. Not sure if this is something on my side (build time) or in the artifacts pathway has for download

romainguy commented 1 year ago

Could be x86 related, I'll take a look next week.

romainguy commented 1 year ago

Fixed in 0.4.0