Re: g_main_dispatch frees objects for input_callback before using them (how to prevent it?)



2014-10-10 14:07 GMT+02:00 Chris Vine <chris cvine freeserve co uk>:
> No, but this change can't be right:
>
>   -
>   -static void stat_master_input_callback (struct stat_conn *conn, int fd,
>   -                                        GdkInputCondition condition) {
>   +static GIOFunc stat_master_input_callback (struct stat_conn *conn, int fd,
>   +                                           GIOCondition condition) {
>
> because you do not appear actually to change the return statement in the
> function stat_master_input_callback(), which was void before (unless this
> is in a different commit).  Is this now a callback factory function - it
> didn't appear to be so before.

Thanks a lot, you are right ! And this was not the only typing mistake I have done…
I fix that: https://github.com/XQF/xqf/commit/0e17fd9ea61c7a10d4a2d0cfdc275e0c09b33fd2

It does not solve my problem yet, but it will be better that way! :D
Thanks for your help.

So, that is the current diff between my master branch and my g_io branch:
https://github.com/XQF/xqf/compare/master...g_io

The fact that glib loses my pointer is still a great mystery to me.
There's certainly something I've forgotten, but I do not know what!

> This may not be an issue in your code but note that a callback function
> used as an io watch must return gboolean, and the return value is used to
> determine whether the io watch is removed from the list of sources.
> If you cast a function returning void to GIOFunc, you will get random
> and undefined results.
>
> Chris

Hum, it's really interesting, the problem may be there!
I'll try to change that.

Thank you for your help.


--
Thomas DEBESSE


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]