SourceId should implement remove #386
Comments
That would be tricky as you'd need to carry additional things (the main context) around with the source id, potentially causing memory leaks |
We'll just call the function inside it directly. I had something like this in mind: impl SourceId {
pub fn remove(self) {
glib::source_remove(self);
}
} |
That only works for sources on the default main context and will otherwise cause assertions or worse |
This is already the case with the function itself so I think I'm missing something here... |
You need the function on the main context, not the global/free function |
Yes but again, we're just doing exactly the same as before except that we wrapped it into a method. |
How would you get the main context into the method? |
I don't understand why you're talking about context. In the function, there is no such thing: http://gtk-rs.org/docs/src/glib/source.rs.html#256-260 |
That's exactly my point. You can only call this function for source ids that came from the default main context :) To quote the documentation
|
Ok I got it. Well then, it'd be even safer to actually have this additional information. Like that, no chance to call the wrong function. |
Let's close this then until someone comes up with a real need for this? |
For now, we're forced to call
source_remove
and pass theSourceId
as parameter. Not very nice...The text was updated successfully, but these errors were encountered: