Skip to content
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
21 changes: 21 additions & 0 deletions src/gmt_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -7564,6 +7564,27 @@ int GMT_Close_VirtualFile_ (unsigned int *family, char *string, int len) {
}
#endif

int gmtlib_delete_virtualfile (void *V_API, const char *string) {
/* Given a VirtualFile name, delete its record bu NULLing it */
int object_ID, item;
struct GMTAPI_DATA_OBJECT *S_obj = NULL;
struct GMTAPI_CTRL *API = NULL;
if (V_API == NULL) return_error (V_API, GMT_NOT_A_SESSION);
if (string == NULL) return_error (V_API, GMT_PTR_IS_NULL);
if ((object_ID = gmtapi_decode_id (string)) == GMT_NOTSET)
return_error (V_API, GMT_OBJECT_NOT_FOUND);
API = gmtapi_get_api_ptr (V_API);
if ((item = gmtlib_validate_id (API, GMT_NOTSET, object_ID, GMT_NOTSET, GMT_NOTSET)) == GMT_NOTSET)
return_error (API, GMT_OBJECT_NOT_FOUND);
S_obj = API->object[item]; /* Short-hand */
if (S_obj->family != S_obj->actual_family) /* Reset the un-masquerading that GMT_Open_VirtualFile did */
S_obj->family = S_obj->actual_family;
S_obj->no_longer_owner = true;
S_obj->resource = NULL;

return GMT_NOERROR;
}

void * GMT_Read_VirtualFile (void *V_API, const char *string) {
/* Given a VirtualFile name, retrieve the resulting object */
int object_ID;
Expand Down
1 change: 1 addition & 0 deletions src/gmt_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct GMT_XINGS {
EXTERN_MSC char *dlerror (void);
#endif

EXTERN_MSC int gmtlib_delete_virtualfile (void *API, const char *string);
EXTERN_MSC bool gmtlib_file_lock (struct GMT_CTRL *GMT, int fd);
EXTERN_MSC bool gmtlib_file_unlock (struct GMT_CTRL *GMT, int fd);
EXTERN_MSC int gmtlib_file_is_jpeg2000_tile (struct GMTAPI_CTRL *API, char *file);
Expand Down
5 changes: 5 additions & 0 deletions src/gmt_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,11 @@ struct GMT_GRID *gmtlib_assemble_tiles (struct GMTAPI_CTRL *API, double *region,
GMT_Report (API, GMT_MSG_ERROR, "ERROR - Unable to receive blended grid from grdblend\n");
return NULL;
}
if (gmtlib_delete_virtualfile (API, grid)) { /* Remove trace since passed upwards anyway */
GMT_Report (API, GMT_MSG_ERROR, "ERROR - Unable to destroy temporary object for assembled grid\n");
return NULL;
}

HH = gmt_get_H_hidden (G->header);
HH->orig_datatype = GMT_SHORT; /* Since we know this */
return (G);
Expand Down