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:
parent
fcc7595882
commit
ce03b02a79
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CrossThreadChannel::CrossThreadChannel (bool non_blocking)
|
CrossThreadChannel::CrossThreadChannel (bool non_blocking)
|
||||||
: receive_channel (0)
|
: receive_channel (0)
|
||||||
|
, receive_source (0)
|
||||||
{
|
{
|
||||||
fds[0] = -1;
|
fds[0] = -1;
|
||||||
fds[1] = -1;
|
fds[1] = -1;
|
||||||
@ -28,8 +29,14 @@ CrossThreadChannel::CrossThreadChannel (bool non_blocking)
|
|||||||
|
|
||||||
CrossThreadChannel::~CrossThreadChannel ()
|
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);
|
g_io_channel_unref (receive_channel);
|
||||||
|
receive_channel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fds[0] >= 0) {
|
if (fds[0] >= 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user