Revert "Stdio.Buffer: Check for PIKE_T_FUNCTION before acting on objects."

This reverts commit 01543a00.

This commit was part of a set of speculative fixes that
introduced other issues (SIGSEGV in testsuite).
parent 3254d210
...@@ -455,14 +455,16 @@ PIKECLASS Buffer ...@@ -455,14 +455,16 @@ PIKECLASS Buffer
PMOD_EXPORT void io_actually_trigger_output( Buffer *io ) PMOD_EXPORT void io_actually_trigger_output( Buffer *io )
{ {
if (io->output.tu.named_type == PIKE_T_FUNCTION) { if (UNLIKELY(!io->output.u.object->prog)) {
if (UNLIKELY(!io->output.u.object->prog)) { /* Destructed object. */
/* Destructed object. */ free_svalue(&io->output);
free_svalue(&io->output); SET_SVAL(io->output, PIKE_T_INT, NUMBER_NUMBER, integer, 0);
return; return;
} }
if ( io->output.u.object ) {
move_svalue(Pike_sp++, &io->output); move_svalue(Pike_sp++, &io->output);
SET_SVAL(io->output, PIKE_T_INT, NUMBER_NUMBER, integer, 0);
apply_svalue(Pike_sp-1, 0); apply_svalue(Pike_sp-1, 0);
pop_n_elems(2); pop_n_elems(2);
} }
...@@ -988,8 +990,11 @@ PIKECLASS Buffer ...@@ -988,8 +990,11 @@ PIKECLASS Buffer
if (f) if (f)
assign_svalue(&io->output, f); assign_svalue(&io->output, f);
else { else {
if (io->output.tu.named_type == PIKE_T_FUNCTION) if (io->output.u.object) {
free_svalue(&io->output); free_svalue(&io->output);
io->output.u.object = 0; // free_svalue() puts in -1
}
SET_SVAL(io->output, PIKE_T_INT, NUMBER_NUMBER, integer, 0);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment