diff options
author | David Robillard <d@drobilla.net> | 2008-05-13 00:15:26 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-05-13 00:15:26 +0000 |
commit | a25be81b5df6d68449f0775a847f83ab5b30df7f (patch) | |
tree | ee2994b49647788979ea8919b168d0d571073dc0 /libs/midi++2/midi++/event.h | |
parent | bded96269f8b3fdd5d7f7a7d830c9e353dae3eb2 (diff) |
Fix event allocation issues with MidiModel iteration.
git-svn-id: svn://localhost/ardour2/branches/3.0@3342 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/midi++2/midi++/event.h')
-rw-r--r-- | libs/midi++2/midi++/event.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/midi++2/midi++/event.h b/libs/midi++2/midi++/event.h index 4a0210095f..fed5c5dd44 100644 --- a/libs/midi++2/midi++/event.h +++ b/libs/midi++2/midi++/event.h @@ -155,8 +155,14 @@ struct Event { } inline void realloc(size_t size) { - assert(_owns_buffer); - _buffer = (uint8_t*) ::realloc(_buffer, size); + if (_owns_buffer) { + _buffer = (uint8_t*) ::realloc(_buffer, size); + } else { + _buffer = (uint8_t*) ::malloc(size); + _owns_buffer = true; + } + + _size = size; } #else |