# HG changeset patch # User Jaroslav Hajek # Date 1235059468 -3600 # Node ID a4a8f871be81e9910f242c1a0f32286b1d565309 # Parent af907aeedbf4a0ebdeb87c7be6dd254576757499 fix missing init in octave_sort::sortrows diff -r af907aeedbf4 -r a4a8f871be81 liboctave/oct-sort.cc --- a/liboctave/oct-sort.cc Thu Feb 19 16:37:17 2009 +0100 +++ b/liboctave/oct-sort.cc Thu Feb 19 17:04:28 2009 +0100 @@ -506,6 +506,7 @@ delete [] ms->ia; ms->alloced = 0; ms->a = 0; + ms->ia = 0; } } @@ -1700,6 +1701,17 @@ octave_sort::sort_rows (const T *data, octave_idx_type *idx, octave_idx_type rows, octave_idx_type cols) { + /* Re-initialize the Mergestate as this might be the second time called */ + if (ms) + { + ms->n = 0; + ms->min_gallop = MIN_GALLOP; + } + else + merge_init (); + + merge_getmemi (1024); + #ifdef INLINE_ASCENDING_SORT if (compare == ascending_compare) sort_rows (data, idx, rows, cols, std::less ());