RESOLVED FIXED136923
[GTK] Dot not allow to create delete-on-destroy GMainLoopSources
https://bugs.webkit.org/show_bug.cgi?id=136923
Summary [GTK] Dot not allow to create delete-on-destroy GMainLoopSources
Carlos Garcia Campos
Reported 2014-09-18 08:09:37 PDT
We have several asserts to ensure that delete-on-destroy sources are not misused, like not scheduling socket sources on a delete on destroy GMainLoopSource or not allowing to cancel them before they have been dispatched. It would be better if we can ensure all those things at compile time, so instead of having static method to create a delete-on-destroy source with all the API available, we could add static methods to schedule sources creating a delete-on-destroy GMainLoopSource that is not returned to the user.
Attachments
Patch (16.40 KB, patch)
2014-09-18 08:17 PDT, Carlos Garcia Campos
no flags
Patch (16.39 KB, patch)
2014-09-18 08:51 PDT, Carlos Garcia Campos
gustavo: review+
Carlos Garcia Campos
Comment 1 2014-09-18 08:17:06 PDT
Carlos Garcia Campos
Comment 2 2014-09-18 08:51:32 PDT
Gustavo Noronha (kov)
Comment 3 2014-09-18 13:08:47 PDT
Comment on attachment 238310 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=238310&action=review > Source/WTF/wtf/gobject/GMainLoopSource.cpp:36 > -GMainLoopSource& GMainLoopSource::createAndDeleteOnDestroy() > +GMainLoopSource& GMainLoopSource::create() I think this name should be kept, otherwise it may lead people to believe that this is the default or only way of creating, like on other objects, it gets confusing. > Source/WTF/wtf/gobject/GMainLoopSource.cpp:-85 > - // Delete-on-destroy GMainLoopSource objects can only be cancelled when there's callback either scheduled > - // or in the middle of dispatch. At that point cancellation will have no effect. > - ASSERT(m_deleteOnDestroy != DeleteOnDestroy || (m_status == Ready && !m_context.source)); Heh, this was a bit weird.
Carlos Garcia Campos
Comment 4 2014-09-18 23:34:04 PDT
(In reply to comment #3) > (From update of attachment 238310 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=238310&action=review > > > Source/WTF/wtf/gobject/GMainLoopSource.cpp:36 > > -GMainLoopSource& GMainLoopSource::createAndDeleteOnDestroy() > > +GMainLoopSource& GMainLoopSource::create() > > I think this name should be kept, otherwise it may lead people to believe that this is the default or only way of creating, like on other objects, it gets confusing. But I made it private for that reason, so it can only be created inside the object. > > Source/WTF/wtf/gobject/GMainLoopSource.cpp:-85 > > - // Delete-on-destroy GMainLoopSource objects can only be cancelled when there's callback either scheduled > > - // or in the middle of dispatch. At that point cancellation will have no effect. > > - ASSERT(m_deleteOnDestroy != DeleteOnDestroy || (m_status == Ready && !m_context.source)); > > Heh, this was a bit weird. Yes.
Carlos Garcia Campos
Comment 5 2014-09-18 23:51:40 PDT
Note You need to log in before you can comment on or make changes to this bug.