Ingo, -----Original Message----- >From: Ingo Krabbe <ikrabbe.ask@xxxxxxxxx> >Sent: Mar 27, 2011 12:33 AM >To: gtk-list@xxxxxxxxx >Subject: Re: Timer start registration breaks the gtk_main() > >On Sat, Mar 26, 2011 at 11:48:38PM -0700, ikorot@xxxxxxxxxxxxx wrote: >> Lex, >> >> >> -----Original Message----- >> >From: Lex Trotman <elextr@xxxxxxxxx> >> >Sent: Mar 26, 2011 10:47 PM >> >To: ikorot@xxxxxxxxxxxxx >> >Cc: gtk-list <gtk-list@xxxxxxxxx> >> >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@xxxxxxxxx >http://mail.gnome.org/mailman/listinfo/gtk-list _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list