PasteEventsCommand can cause crashes because it contains an
EventSelection. EventSelection wants to always refer to a live segment
(*), but it is possible for the segment that events came from to be
deleted while the command remains on the undo stack. Then when the undo
stack is truncated, the PasteEventsCommand is deleted, its EventSelection
is deleted and, as a SegmentObserver, tries to remove itself from the
deleted segment's observers. Segfault and kaboom!
I've fixed it by making PasteEventsCommand not hold EventSelection but
create it for getSubsequentSelection, as other commands do.
So that's fixed, but wolves still lurk.
The only reason that we're not crashing similarly on many other commands
that contain EventSelection is that another bug is hiding the problem!
Many commands hold a pointer to EventSelection, and of those that actually
own the pointer (**), they all just leak it and never call its destructor.
Thus one bug saves us from another bug, which is convenient but hardly
ideal. If those leaks ever get fixed, segfault and kaboom again!
(*) It has to. It would be a mistake to make EventSelection accept its
segment sometimes being deleted. Tons of things expect it to provide a
live segment via getSegment. They'd have to all check it and fail
gracefully.
(**) Some commands sometimes own their pointer and sometimes don't! Eg
EraseCommand. EventView::slotEditDelete gives it pointer to own while
other users of EraseCommand maintain ownership of that pointer.
Tom Breton (Tehom)
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel