projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Follow-up to bugfix #58664
[pspp]
/
src
/
data
/
file-handle-def.c
diff --git
a/src/data/file-handle-def.c
b/src/data/file-handle-def.c
index 4546a9ca0c4a137571878b2dab9086d4b63134c0..716a029cc701a567d4c28c53ab0119fed66d003f 100644
(file)
--- a/
src/data/file-handle-def.c
+++ b/
src/data/file-handle-def.c
@@
-115,12
+115,17
@@
fh_done (void)
HMAP_FOR_EACH_SAFE (handle, next,
struct file_handle, name_node, &named_handles)
unname_handle (handle);
HMAP_FOR_EACH_SAFE (handle, next,
struct file_handle, name_node, &named_handles)
unname_handle (handle);
+
+ free_handle (inline_file);
}
/* Free HANDLE and remove it from the global list. */
static void
free_handle (struct file_handle *handle)
{
}
/* Free HANDLE and remove it from the global list. */
static void
free_handle (struct file_handle *handle)
{
+ if (handle == NULL)
+ return;
+
/* Remove handle from global list. */
if (handle->id != NULL)
hmap_delete (&named_handles, &handle->name_node);
/* Remove handle from global list. */
if (handle->id != NULL)
hmap_delete (&named_handles, &handle->name_node);
@@
-153,6
+158,8
@@
unname_handle (struct file_handle *handle)
struct file_handle *
fh_ref (struct file_handle *handle)
{
struct file_handle *
fh_ref (struct file_handle *handle)
{
+ if (handle == fh_inline_file ())
+ return handle;
assert (handle->ref_cnt > 0);
handle->ref_cnt++;
return handle;
assert (handle->ref_cnt > 0);
handle->ref_cnt++;
return handle;
@@
-165,6
+172,8
@@
fh_unref (struct file_handle *handle)
{
if (handle != NULL)
{
{
if (handle != NULL)
{
+ if (handle == fh_inline_file ())
+ return;
assert (handle->ref_cnt > 0);
if (--handle->ref_cnt == 0)
free_handle (handle);
assert (handle->ref_cnt > 0);
if (--handle->ref_cnt == 0)
free_handle (handle);
@@
-409,7
+418,7
@@
fh_set_default_handle (struct file_handle *new_default_handle)
fh_unref (default_handle);
default_handle = new_default_handle;
if (default_handle != NULL)
fh_unref (default_handle);
default_handle = new_default_handle;
if (default_handle != NULL)
- fh_ref (default_handle);
+
default_handle =
fh_ref (default_handle);
}
\f
/* Information about a file handle's readers or writers. */
}
\f
/* Information about a file handle's readers or writers. */