RE: Glib::signal_timeout().connect_seconds



I am surprised that g++ doesn't give you a warning while compiling that piece of code. In "MainWindow::onTimeout30s()" you have forgotten to return a value. Put "return true;" If you want MainWindow::onTimeout30s() to be called again or "return false" to disconnect the signal handler.

> From: mik gmx org
> To: gtkmm-list gnome org
> Subject: Glib::signal_timeout().connect_seconds
> Date: Sat, 17 Oct 2009 12:52:11 +0200
>
> Hello everybody!
>
> I have a strange problem when using signal_timeout(). The code below triggers
> every 30 seconds the member function onTimeout30s. Everything works fine
> inside KDevelop. Kompiling it into a openSUSE rpm the memberfunction is
> called once and never again. The only difference I can imagine is that
> KDevelop compiles with debug statement which only should help gnu debugger to
> find break points.
>
> Any idea whats wrong?
>
> Thanks in advance.
>
>
> -- MIK
>
>
>
> BTW: gtkmm is great and easy to use. Thanks for that peace of software.
>
>
> 8< 8< 8< code 8< 8< 8<
>
> Konstruktor {
>
> mTimeoutConnection =
> Glib::signal_timeout().connect_seconds(sigc::bind(sigc::mem_fun(*this,
> &MainWindow::onTimeout30s),0), 30);
> }
>
>
> bool MainWindow::onTimeout30s(int timerNumber)
> {
> clog << "MainWindow::onTimeout30s" << std::endl;
>
> clog << "mTimeoutConnection::empty " <<
> (mTimeoutConnection.empty()?"true":"false") << endl;
> clog << "mTimeoutConnection::connected " <<
> (mTimeoutConnection.connected()?"true":"false") << endl;
> }
>
> 8 >8 >8 >8 code >8 >8 >8
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list


Windows Live: Κρατήστε τους φίλους σας ενήμερους για τις δραστηριότητές σας στο Internet.


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