glib: fix double-free of source tags
glib 2.39.0 (aka GNOME 3.10) as found in Ubuntu Trusty introduces warnings when g_source_remove() is passed an unknown tag. SyncEvolution did this in two cases: in both, the source callback returned false and thus caused the source to be removed by the caller. In that case, the explicit g_source_remove() is redundant and must be avoided. Such a call is faulty and might accidentally remove a new source with the same tag (unlikely though, given that tags seem to get assigned incrementally). The only noticable effect were additional error messages with different numbers: [ERROR] GLib: Source ID 9 was not found when attempting to remove it
This commit is contained in:
parent
599580649f
commit
2d6d1cfa9c
|
@ -333,11 +333,14 @@ gboolean ForkExecParent::outputReady(GIOChannel *source,
|
|||
// Will remove event source from main loop.
|
||||
cont = false;
|
||||
|
||||
// Free channel.
|
||||
// Free channel and forget source tag (source will be freed
|
||||
// by caller when we return false).
|
||||
if (source == me->m_out) {
|
||||
me->m_out = NULL;
|
||||
me->m_outID = 0;
|
||||
} else {
|
||||
me->m_err = NULL;
|
||||
me->m_errID = 0;
|
||||
}
|
||||
g_io_channel_unref(source);
|
||||
|
||||
|
|
|
@ -782,6 +782,11 @@ double Sleep(double seconds)
|
|||
"glib timeout");
|
||||
GRunWhile(! boost::lambda::var(triggered) &&
|
||||
boost::lambda::bind(&SuspendFlags::getState, boost::ref(s)) == SuspendFlags::NORMAL);
|
||||
// SleepTimeout already removed the source if it was triggered
|
||||
// and returned false. No need to auto-destruct it again.
|
||||
if (triggered) {
|
||||
timeout.release();
|
||||
}
|
||||
// done
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue