fix potentially crash-inducing race condition by removing event loops' x-thread channel from an event loop when it is destroyed
This commit is contained in:
parent
157253c2c6
commit
8519677a24
@ -29,6 +29,14 @@ CrossThreadChannel::CrossThreadChannel (bool non_blocking)
|
||||
|
||||
CrossThreadChannel::~CrossThreadChannel ()
|
||||
{
|
||||
if (receive_source) {
|
||||
/* this disconnects it from any main context it was attached in
|
||||
in ::attach(), this prevent its callback from being invoked
|
||||
after the destructor has finished.
|
||||
*/
|
||||
g_source_destroy (receive_source);
|
||||
}
|
||||
|
||||
if (receive_channel) {
|
||||
g_io_channel_unref (receive_channel);
|
||||
receive_channel = 0;
|
||||
|
@ -89,6 +89,14 @@ CrossThreadChannel::CrossThreadChannel (bool non_blocking)
|
||||
|
||||
CrossThreadChannel::~CrossThreadChannel ()
|
||||
{
|
||||
if (receive_source) {
|
||||
/* this disconnects it from any main context it was attached in
|
||||
in ::attach(), this prevent its callback from being invoked
|
||||
after the destructor has finished.
|
||||
*/
|
||||
g_source_destroy (receive_source);
|
||||
}
|
||||
|
||||
/* glibmm hack */
|
||||
|
||||
if (receive_channel) {
|
||||
|
Loading…
Reference in New Issue
Block a user