Mercurial > octave
changeset 28968:437e04d9c449
maint: merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Oct 2020 13:28:36 -0400 |
parents | b02d9109fb6e (current diff) bcfa15435e4c (diff) |
children | 0474f7837cfc |
files | |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/array/dim-vector.cc Tue Oct 20 01:29:00 2020 -0400 +++ b/liboctave/array/dim-vector.cc Tue Oct 20 13:28:36 2020 -0400 @@ -39,8 +39,16 @@ octave_idx_type * dim_vector::nil_rep (void) { - static dim_vector zv (0, 0); - return zv.rep; + // Create a statically allocated rep object with an initial reference + // count of 1. The dim_vector constructor that uses this object will + // increment the reference count. The dim_vector destructor and copy + // assignment operator will decrement the reference count but those + // operations can never cause the count to become zero so they will + // never call delete on this object. + + static octave_idx_type nr[4] = { 1, 2, 0, 0 }; + + return &nr[2]; } // The maximum allowed value for a dimension extent. This will normally be a