Skip to content

Commit 990d344

Browse files
authored
Merge pull request #2268 from TFBW/fix-issue-2220
Fix memory leak in AWAIT_ON_READY
2 parents f9b7f72 + e3a84f2 commit 990d344

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Mojo/Promise.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ sub AWAIT_NEW_FAIL { _await('reject', @_) }
3737
sub AWAIT_ON_CANCEL { }
3838

3939
sub AWAIT_ON_READY {
40-
shift->_finally(0, @_)->catch(sub { });
40+
my ($self, $cb) = @_;
41+
push @{$self->{resolve}}, $cb;
42+
push @{$self->{reject}}, $cb;
4143
}
4244

4345
sub AWAIT_WAIT {

0 commit comments

Comments
 (0)