Skip to content

BUG: Add casts to GEOSGeom_destroy_r and GEOSGeom_createPolygon_r.#2293

Merged
jorisvandenbossche merged 3 commits intoshapely:mainfrom
schwehr:geometry-helpers-casting
May 19, 2025
Merged

BUG: Add casts to GEOSGeom_destroy_r and GEOSGeom_createPolygon_r.#2293
jorisvandenbossche merged 3 commits intoshapely:mainfrom
schwehr:geometry-helpers-casting

Conversation

@schwehr
Copy link
Copy Markdown
Contributor

@schwehr schwehr commented May 2, 2025

Fixes #2289

Copy link
Copy Markdown
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

g = <GEOSGeometry *>arr[i]
if g != NULL:
GEOSGeom_destroy_r(handle, <GEOSGeometry *>arr[i])
GEOSGeom_destroy_r(<GEOSContextHandle_t> handle, <GEOSGeometry *>arr[i])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, could you change the void* handle in GEOSContextHandle_t handle in the _deallocate_arr signature a few lines above? That should also fix it and feels better (everywhere we use this helper function, the handler is declared to be a context handle)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'll test it on my local code and do that if it works, but it might be Monday before I get to it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(small ping, otherwise I can also push myself after the weekend)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schwehr updated here (I want to get this out in a 2.1.1 release), going to assume my suggestion is also fixing the original issue you noticed (but please test and let us know if not!)

@jorisvandenbossche
Copy link
Copy Markdown
Member

@schwehr thanks for the report and PR!

@jorisvandenbossche jorisvandenbossche changed the title FIX: Add casts to GEOSGeom_destroy_r and GEOSGeom_createPolygon_r. BUG: Add casts to GEOSGeom_destroy_r and GEOSGeom_createPolygon_r. May 19, 2025
@jorisvandenbossche jorisvandenbossche merged commit b6515a6 into shapely:main May 19, 2025
23 of 26 checks passed
hillwithsmallfields pushed a commit to hillwithsmallfields/shapely that referenced this pull request Dec 9, 2025
…hapely#2293)

Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

incomplete type 'void *' to 'GEOSContextHandle_t' for GEOSGeom_destroy_r and GEOSGeom_createPolygon_r

2 participants