Fixed a serious bug in the TransactionGroup which would cause the TransactionGroup to crash when all the transactions it gets passed in the constructor were in the ended state; fixed another serious bug that would occur when transactions reached the ended state during the constructor; wrote unit tests that reproduced those bugs
git-svn-id: file:///srv/devel/repo-conversion/nusu@121 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
parent
a2f53639d4
commit
190e32ee56
6 changed files with 164 additions and 26 deletions
|
@ -98,7 +98,10 @@ namespace Nuclex.Support.Tracking {
|
|||
IObservationSubscriber subscriber = this.mockery.NewMock<IObservationSubscriber>();
|
||||
|
||||
Expect.AtLeast(0).On(subscriber).Method("ProgressUpdated");
|
||||
Expect.Once.On(subscriber).Method("Ended");
|
||||
// This should no be called because otherwise, the 'Ended' event would be raised
|
||||
// to the transaction group before all transactions have been added into
|
||||
// the internal list, leading to an early ending or even multiple endings.
|
||||
Expect.Never.On(subscriber).Method("Ended");
|
||||
|
||||
using(
|
||||
ObservedWeightedTransaction<Transaction> test =
|
||||
|
|
|
@ -58,7 +58,12 @@ namespace Nuclex.Support.Tracking {
|
|||
// prevent object coupling where none is neccessary and to save some processing time.
|
||||
this.progress = 1.0f;
|
||||
progressUpdateCallback();
|
||||
endedCallback();
|
||||
|
||||
// Do not call the ended callback here. This constructor is called when the
|
||||
// TransactionGroup constructs its list of transactions. If this is called and
|
||||
// the first transaction to be added to the group happens to be in the ended
|
||||
// state, the transactionGroup will immediately think it has ended!
|
||||
//!DONT!endedCallback();
|
||||
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue