Skip to content

Commit

Permalink
fixed bug in channel.get() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
EmielBruijntjes committed Aug 4, 2014
1 parent e299aa5 commit d99b117
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/deferredget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ Deferred *DeferredGet::reportSuccess(uint32_t messageCount) const
// we now know the name, so we can install the message callback on the channel
_channel->install("", [channel, messageCallback, finalizeCallback](const Message &message, uint64_t deliveryTag, bool redelivered) {

// we can remove the callback now from the channel
channel->uninstall("");
// install a monitor to deal with the case that the channel is removed
Monitor monitor(channel);

// call the callbacks
if (messageCallback) messageCallback(message, deliveryTag, redelivered);

// call the finalize callback
if (finalizeCallback) finalizeCallback();

// we can remove the callback now from the channel
if (monitor.valid()) channel->uninstall("");
});

// return next object
Expand Down

0 comments on commit d99b117

Please sign in to comment.