Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: address issue where PROJ core dumps on proj_create with +init= when global context does not have data directory set #419

Merged
merged 1 commit into from
Aug 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Change Log
~~~~~
* Added cleanup for internal PROJ errors (issue #413)
* Delay checking for pyproj data directory until importing pyproj (issue #415)
* Address issue where PROJ core dumps on proj_create with +init= when global context does not have data directory set (issue #415 & issue #368)

2.3.0
~~~~~
Expand Down
2 changes: 1 addition & 1 deletion pyproj/_datadir.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ cdef void pyproj_log_function(void *user_data, int level, const char *error_msg)
if level == PJ_LOG_ERROR:
ProjError.internal_proj_error = pystrdecode(error_msg)


cdef class ContextManager:
def __cinit__(self):
self.context = NULL
Expand Down Expand Up @@ -42,6 +41,7 @@ cdef class ContextManager:
for iii in range(len(data_dir_list)):
b_data_dir = cstrencode(data_dir_list[iii])
c_data_dir[iii] = b_data_dir
proj_context_set_search_paths(NULL, len(data_dir_list), c_data_dir)
Copy link
Contributor

Choose a reason for hiding this comment

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

Small remark here: it might be useful to add a comment on why this line is here (maybe linking to one of the issue explaining it).

I was actually reading this code in one of the other PRs and already wondering why the search paths were set twice.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good idea. I would like to change this solution in 2.4 as I don't want to reset the global context each time. It's okay in this context as it is only set once.

proj_context_set_search_paths(self.context, len(data_dir_list), c_data_dir)
finally:
free(c_data_dir)
Expand Down