13
0

in a CrossThread object, ensure destruction of the channel and source used on Posix

The source holds a reference to the channel; both must be unref'ed/destroyed in order to
fully clean up resources
This commit is contained in:
Paul Davis 2015-10-08 21:21:44 -04:00
parent fcc7595882
commit ce03b02a79

View File

@ -2,6 +2,7 @@
CrossThreadChannel::CrossThreadChannel (bool non_blocking)
: receive_channel (0)
, receive_source (0)
{
fds[0] = -1;
fds[1] = -1;
@ -28,8 +29,14 @@ CrossThreadChannel::CrossThreadChannel (bool non_blocking)
CrossThreadChannel::~CrossThreadChannel ()
{
if (receive_channel) {
if (receive_source) {
g_source_destroy (receive_source);
receive_source = 0;
}
if (receive_channel) {
g_io_channel_unref (receive_channel);
receive_channel = 0;
}
if (fds[0] >= 0) {