Есть примерно такой код:
class A{
public:
A(void (*funPnt)(void*)){
_funPnt = funPnt;
}
void start(){
started = true;
loop();
}
void stop(){
started = false;
}
private:
bool started = false;
void (*_funPnt)(void*);
void *args;
void loop(){
while(started){
...
if (...)
if(_funPnt)
_funPnt(args);
}
}
}
class B{
public:
B(){
a = new A([](void *tmp){static_cast<B*>(tmp)->stop()}, this)
}
void start(){
pthread_t thread;
pthread_create(&thread,
nullptr,
[](void * tmp) -> void * {static_cast<A*>(tmp)->start(); return nullptr;},
a);
pthread_join(thread, nullptr);
}
void stop(){
a->stop(); //<----------------------Падает здесь
}
private:
A *a;
}
int main(){
B b;
b.start();
}
В указанной строчке происходит падение.