Memory conflict between disconnect internal and destroy context by user
Hello, I am Wady, your big fans. I find a BUG (please confirm). Create a thread in 'MQTTClient_disconnect_internal()' to notify connection lost and it will reference MQTTClients object. However this object call be freed in 'MQTTClient_destroy()'. I believe this is dangerous.
MQTTClient_destroy() cleans up all the resources associated with a client object. It should only be called when the client is completely and properly disconnected so that those resources are not used any more.
You are perfectly right and reasonable. But for 'MQTTClient_destroy ()', it is not known whether the thread created by 'MQTTClient_disconnect_internal ()' exists, the thread is detach. I think you can check 'MQTTClient_disconnect1()'. Create a thread in the function using 'Thread_start ()'.