gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Fix ImmediateDetach in AlterationObserver (ticket #130)
0 1 0
default
1 file changed with 3 insertions and 3 deletions:
↑ Collapse diff ↑
Ignore white space 24 line context
... ...
@@ -400,47 +400,47 @@
400 400
    /// the container.
401 401
    ///
402 402
    /// It notifies all the registed observers about an item erased from
403 403
    /// the container.
404 404
    ///
405 405
    void erase(const Item& item) throw() {
406 406
      typename Observers::iterator it = _observers.begin();
407 407
      while (it != _observers.end()) {
408 408
        try {
409 409
          (*it)->erase(item);
410 410
          ++it;
411 411
        } catch (const ImmediateDetach&) {
412
          it = _observers.erase(it);
413 412
          (*it)->_index = _observers.end();
414 413
          (*it)->_notifier = 0;
414
          it = _observers.erase(it);
415 415
        }
416 416
      }
417 417
    }
418 418

	
419 419
    /// \brief Notifies all the registed observers about more item erased
420 420
    /// from the container.
421 421
    ///
422 422
    /// It notifies all the registed observers about more item erased from
423 423
    /// the container.
424 424
    ///
425 425
    void erase(const std::vector<Item>& items) {
426 426
      typename Observers::iterator it = _observers.begin();
427 427
      while (it != _observers.end()) {
428 428
        try {
429 429
          (*it)->erase(items);
430 430
          ++it;
431 431
        } catch (const ImmediateDetach&) {
432
          it = _observers.erase(it);
433 432
          (*it)->_index = _observers.end();
434 433
          (*it)->_notifier = 0;
434
          it = _observers.erase(it);
435 435
        }
436 436
      }
437 437
    }
438 438

	
439 439
    /// \brief Notifies all the registed observers about the container is
440 440
    /// built.
441 441
    ///
442 442
    /// Notifies all the registed observers about the container is built
443 443
    /// from an empty container.
444 444
    void build() {
445 445
      typename Observers::reverse_iterator it;
446 446
      try {
... ...
@@ -459,23 +459,23 @@
459 459
    /// \brief Notifies all the registed observers about all items are
460 460
    /// erased.
461 461
    ///
462 462
    /// Notifies all the registed observers about all items are erased
463 463
    /// from the container.
464 464
    void clear() {
465 465
      typename Observers::iterator it = _observers.begin();
466 466
      while (it != _observers.end()) {
467 467
        try {
468 468
          (*it)->clear();
469 469
          ++it;
470 470
        } catch (const ImmediateDetach&) {
471
          it = _observers.erase(it);
472 471
          (*it)->_index = _observers.end();
473 472
          (*it)->_notifier = 0;
473
          it = _observers.erase(it);
474 474
        }
475 475
      }
476 476
    }
477 477
  };
478 478

	
479 479
}
480 480

	
481 481
#endif
0 comments (0 inline)