Commit 516e799
authored
Fix a bug when passing data to GMT in Session.open_virtual_file() (#490)
External programs like PyGMT can pass dataset/momory to GMT. By default,
GMT can read, modify and free the momery, which sometimes can cause
crashes.
Issue #406 reports an example in which PyGMT crashes. The issue was reported
to the upstream (see GenericMappingTools/gmt#3515
and GenericMappingTools/gmt#3528). It turns out
to be a API user error (i.e., a PyGMT bug).
As per the explanation of Paul, external programs like PyGMT should
always use `GMT_IN|GMT_IS_REFERENCE` to tell GMT that the data is
read-only, so that GMT won't try to change and free the memory.
This PR makes the change from `GMT_IN` to `GMT_IN|GMT_IS_REFERENCE`
in the `Session.open_virtual_file()` function, updates a few docstrings,
and also adds the script in #406 as a test.1 parent eaf81bb commit 516e799
File tree
4 files changed
+34
-5
lines changed- pygmt
- clib
- tests
- baseline
4 files changed
+34
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
922 | 922 | | |
923 | 923 | | |
924 | 924 | | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
925 | 928 | | |
926 | 929 | | |
927 | 930 | | |
| |||
950 | 953 | | |
951 | 954 | | |
952 | 955 | | |
953 | | - | |
| 956 | + | |
954 | 957 | | |
955 | 958 | | |
956 | 959 | | |
| |||
1086 | 1089 | | |
1087 | 1090 | | |
1088 | 1091 | | |
1089 | | - | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
1090 | 1095 | | |
1091 | 1096 | | |
1092 | 1097 | | |
| |||
1167 | 1172 | | |
1168 | 1173 | | |
1169 | 1174 | | |
1170 | | - | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1171 | 1178 | | |
1172 | 1179 | | |
1173 | 1180 | | |
| |||
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | | - | |
| 477 | + | |
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
495 | 500 | | |
496 | 501 | | |
497 | 502 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
261 | 278 | | |
262 | 279 | | |
263 | 280 | | |
| |||
0 commit comments