fix event start packets getting deleted while writing because we don't have a lock on them.
parent
5fac0903b1
commit
ace93e2422
|
@ -1983,16 +1983,23 @@ bool Monitor::Analyse() {
|
||||||
snap_it, 0
|
snap_it, 0
|
||||||
);
|
);
|
||||||
|
|
||||||
ZMPacket *starting_packet = *(*start_it);
|
// This gets a lock on the starting packet
|
||||||
|
ZMPacket *starting_packet = packetqueue.get_packet(start_it);
|
||||||
|
|
||||||
event = new Event(this, *(starting_packet->timestamp), "Continuous", noteSetMap);
|
event = new Event(this, *(starting_packet->timestamp), "Continuous", noteSetMap);
|
||||||
// Write out starting packets, do not modify packetqueue it will garbage collect itself
|
// Write out starting packets, do not modify packetqueue it will garbage collect itself
|
||||||
while ( (*start_it) != snap_it ) {
|
while ( starting_packet and (*start_it) != snap_it ) {
|
||||||
ZMPacket *p = packetqueue.get_packet(start_it);
|
event->AddPacket(starting_packet);
|
||||||
if ( !p ) break;
|
// Have added the packet, don't want to unlock it until we have locked the next
|
||||||
event->AddPacket(p);
|
|
||||||
p->unlock();
|
|
||||||
packetqueue.increment_it(start_it);
|
packetqueue.increment_it(start_it);
|
||||||
|
if ( (*start_it) == snap_it ) {
|
||||||
|
starting_packet->unlock();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ZMPacket *p = packetqueue.get_packet(start_it);
|
||||||
|
starting_packet->unlock();
|
||||||
|
starting_packet = p;
|
||||||
}
|
}
|
||||||
packetqueue.free_it(start_it);
|
packetqueue.free_it(start_it);
|
||||||
delete start_it;
|
delete start_it;
|
||||||
|
@ -2068,10 +2075,16 @@ bool Monitor::Analyse() {
|
||||||
event = new Event(this, *(starting_packet->timestamp), cause, noteSetMap);
|
event = new Event(this, *(starting_packet->timestamp), cause, noteSetMap);
|
||||||
// Write out starting packets, do not modify packetqueue it will garbage collect itself
|
// Write out starting packets, do not modify packetqueue it will garbage collect itself
|
||||||
while ( *start_it != snap_it ) {
|
while ( *start_it != snap_it ) {
|
||||||
|
event->AddPacket(starting_packet);
|
||||||
|
|
||||||
|
packetqueue.increment_it(start_it);
|
||||||
|
if ( (*start_it) == snap_it ) {
|
||||||
|
starting_packet->unlock();
|
||||||
|
break;
|
||||||
|
}
|
||||||
ZMPacket *p = packetqueue.get_packet(start_it);
|
ZMPacket *p = packetqueue.get_packet(start_it);
|
||||||
event->AddPacket(p);
|
starting_packet->unlock();
|
||||||
p->unlock();
|
starting_packet = p;
|
||||||
++(*start_it);
|
|
||||||
}
|
}
|
||||||
packetqueue.free_it(start_it);
|
packetqueue.free_it(start_it);
|
||||||
delete start_it;
|
delete start_it;
|
||||||
|
|
Loading…
Reference in New Issue