diff --git a/changelog.in b/changelog.in index 3b76bb1a95..7fcd39d123 100755 --- a/changelog.in +++ b/changelog.in @@ -83,6 +83,16 @@ Rank: minor Fix MSVC compilation of matrix slice conversion operators by fully qualifying their dependent return types. +[ENTRY] +Module: kernel +What: bug +Rank: minor +Issue: 62 +Thanks: k0stjap +[DESCRIPTION] +Dispose the random view selector used by random variable branching so +its random generator handle is released when the brancher is discarded. + [ENTRY] Module: float What: bug diff --git a/gecode/kernel/branch/view-sel.hpp b/gecode/kernel/branch/view-sel.hpp index 32c7d68358..60e502de58 100644 --- a/gecode/kernel/branch/view-sel.hpp +++ b/gecode/kernel/branch/view-sel.hpp @@ -182,6 +182,10 @@ namespace Gecode { //@{ /// Create copy during cloning virtual ViewSel* copy(Space& home); + /// Whether dispose must always be called (that is, notice is needed) + virtual bool notice(void) const; + /// Delete view selection + virtual void dispose(Space& home); //@} }; @@ -539,6 +543,16 @@ namespace Gecode { ViewSelRnd::copy(Space& home) { return new (home) ViewSelRnd(home,*this); } + template + forceinline bool + ViewSelRnd::notice(void) const { + return true; + } + template + forceinline void + ViewSelRnd::dispose(Space&) { + r.~Rnd(); + } template