Lines 62-75
Link Here
|
62 |
{ |
62 |
{ |
63 |
SourceConnectionNode *const self = static_cast<SourceConnectionNode*>(data); |
63 |
SourceConnectionNode *const self = static_cast<SourceConnectionNode*>(data); |
64 |
|
64 |
|
65 |
// if there is no object, this call was triggered from destroy_notify_handler(). |
65 |
// if there is no object, this call was triggered from destroy_notify_handler(), |
|
|
66 |
// because we set self->source_ to 0 there: |
66 |
if (self->source_) |
67 |
if (self->source_) |
67 |
{ |
68 |
{ |
68 |
GSource* s = self->source_; |
69 |
GSource* s = self->source_; |
69 |
self->source_ = 0; |
70 |
self->source_ = 0; |
70 |
g_source_destroy(s); |
71 |
g_source_destroy(s); |
71 |
|
72 |
|
72 |
delete self; |
73 |
// Destroying the object triggers execution of destroy_notify_handler(), |
|
|
74 |
// eiter immediately or later, so we leave that to do the deletion. |
73 |
} |
75 |
} |
74 |
|
76 |
|
75 |
return 0; |
77 |
return 0; |
Lines 80-87
Link Here
|
80 |
{ |
82 |
{ |
81 |
SourceConnectionNode *const self = static_cast<SourceConnectionNode*>(data); |
83 |
SourceConnectionNode *const self = static_cast<SourceConnectionNode*>(data); |
82 |
|
84 |
|
83 |
// if there is no object, this call was triggered from notify(). |
85 |
if (self) |
84 |
if (self->source_) |
|
|
85 |
{ |
86 |
{ |
86 |
// The GLib side is disconnected now, thus the GSource* is no longer valid. |
87 |
// The GLib side is disconnected now, thus the GSource* is no longer valid. |
87 |
self->source_ = 0; |
88 |
self->source_ = 0; |