Branch: Tag:

2020-08-02

2020-08-02 12:26:55 by Henrik Grubbström (Grubba) <grubba@grubba.org>

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

This reverts commit 01543a00e48294140995709915891d7f7745bdb2.

This commit was part of a set of speculative fixes that
introduced other issues (SIGSEGV in testsuite).

455:       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)) {    /* Destructed object. */    free_svalue(&io->output); -  +  SET_SVAL(io->output, PIKE_T_INT, NUMBER_NUMBER, integer, 0);    return;    }    -  +  if ( io->output.u.object ) {    move_svalue(Pike_sp++, &io->output); -  +  SET_SVAL(io->output, PIKE_T_INT, NUMBER_NUMBER, integer, 0);    apply_svalue(Pike_sp-1, 0);    pop_n_elems(2);    }
988:    if (f)    assign_svalue(&io->output, f);    else { -  if (io->output.tu.named_type == PIKE_T_FUNCTION) +  if (io->output.u.object) {    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);    } -  +  }       /*! @decl int(-1..) output_to( Stdio.Stream|function(string(8bit):int) fun, @    *! int(0..)|void nbytes )