fritzone / miso

Micro Signal/Slot implementetation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash on disconnect when only one connect is called

theo-dep opened this issue · comments

Thanks you for your project for signal/slot handling! I am trying to make an app without Qt but with an event loop and your project respond very well to my need.

I found a crash when I am calling disconnect with only one connect previously called. In your example, if I uncomment the last main and if I change that lines:

auto lambdv = []() {std::cout << "lambvoid" << std::endl; };
miso::connect(src.click, lambdv);
//miso::connect(src.click, std::bind(&other_class::clicked, dst));
//miso::connect(src.click, global_void_method);
//miso::connect(src.click, f);

Then the output is:

mc_addre0x7ffdb71c77f0
lambvoid
Erreur de segmentation (core dumped)

Here the stack:

#0 0x000055555559e0c9 in miso::signal<>::emit_signal() (this=0x7fffffffd6b0) at /home/theo/Dev/miso/miso.h:126
#1 0x000055555559b2e6 in miso::signal<>::delayed_call<>(miso::internal::sequence<> const&) (this=0x7fffffffd6b0) at /home/theo/Dev/miso/miso.h:132
#2 0x000055555559a8ce in miso::signal<>::delayed_dispatch() (this=0x7fffffffd6b0) at /home/theo/Dev/miso/miso.h:136
#3 0x000055555559a0c3 in miso::internal::operator<< <my_class>(miso::internal::emitter<my_class>&&, miso::signal<>&) (e=..., s=...) at /home/theo/Dev/miso/miso.h:96
#4 0x0000555555599787 in my_class::some_method (this=0x7fffffffd6b0) at /home/theo/Dev/miso/miso.cpp:141
#5 0x0000555555593a75 in main (argc=1, argv=0x7fffffffd8a8) at /home/theo/Dev/miso/miso.cpp:200

I will trying to fix that but I need to look more closer your code :).