且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Gtkmm创建信号

更新时间:2023-02-21 09:32:38

menuit->signal_activate().connect([&bo]() {bo->next_page();});

您通过引用捕获了 bo ,因此,在执行信号时,我想捕获已成为悬挂的引用。

You're capturing bo by reference, so at the time the signal is executed, I guess the capture became a dangling reference.

尝试复制(毕竟, bo 是一个指针):

Try by copy (after all, bo is a pointer):

menuit->signal_activate().connect([bo]() {bo->next_page();});