Re: Timer start registration breaks the gtk_main()
- From: ikorot earthlink net
- To: Ingo Krabbe <ikrabbe ask gmail com>, gtk-list gnome org
- Subject: Re: Timer start registration breaks the gtk_main()
- Date: Sun, 27 Mar 2011 04:15:04 -0400 (EDT)
Ingo,
-----Original Message-----
>From: Ingo Krabbe <ikrabbe ask gmail com>
>Sent: Mar 27, 2011 12:33 AM
>To: gtk-list gnome org
>Subject: Re: Timer start registration breaks the gtk_main()
>
>On Sat, Mar 26, 2011 at 11:48:38PM -0700, ikorot earthlink net wrote:
>> Lex,
>>
>>
>> -----Original Message-----
>> >From: Lex Trotman <elextr gmail com>
>> >Sent: Mar 26, 2011 10:47 PM
>> >To: ikorot earthlink net
>> >Cc: gtk-list <gtk-list gnome org>
>> >Subject: Re: Timer start registration breaks the gtk_main()
>> >
>> >>>It is not automagically passed a pointer to an instance of the object
>> >>>(no "this") so it will only work if the function does not access any
>> >>>instance members.
>> >>
>> >> Which means that every member of the class that will be used by this function
>> >> should be static. But this is not good.
>> >
>> >Not if you want more than one instance :-)
>>
>> Which is not the case here. ;-)
>
>To make that finally clear, thats why the signal functions pass a data
>pointer. So to use C++ you can always either pass the object into the
>static function:
>
> class CFrame {
> static gboolean ReadData(CFrame* me);
> };
> /* ... */
> g_timeout_add_seconds(1,(GSourceFunc)CFrame::ReadData,frame);
>
>or I would prefer to leave the C++ alone and write a small wrapper
>
> frame_ReadData(CFrame* f) { return f->ReadData(); }
> /* ... */
> g_timeout_add_seconds(1,(GSourceFunc)frame_ReadData,frame);
Shouldn't it be:
static frame_ReadData(CFrame *f) { return f->ReadData(); }
?
Thank you.
>
>_______________________________________________
>gtk-list mailing list
>gtk-list gnome org
>http://mail.gnome.org/mailman/listinfo/gtk-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]