robotconscience / ofxLibwebsockets

[Deprecated] openFrameworks wrapper of libwebsockets for WebSocket client and server functionality
Other
171 stars 68 forks source link

libwebsocket_context_destroy crashes #89

Open pierdr opened 8 years ago

pierdr commented 8 years ago

Hi, I'm using ofxLibwebsocket as a client and it works, but as soon as the server goes offline the sketch crashes at line 284 of Client.cpp: https://github.com/robotconscience/ofxLibwebsockets/blob/master/libs/ofxLibwebsockets/src/Client.cpp#L284 libwebsocket_context_destroy( context );

And the error is the following: malloc: *\ error for object 0x600000221c20: pointer being freed was not allocated


Context is never null when the program arrives there.

Ideas?

robotconscience commented 8 years ago

Hey @pierdr! Sorry you're having this issue. I think I've seen it before, but thought it was fixed.

My fear is it's something internal with lws; you can see we're pretty out-of-date relative to their whole library. Haven't had time to do a re-write, as they've changed their API. You might be able to build one of their 1.5+ versions (1.7 is a new rewrite) and drop that in?

You might be able to swap in the newer c++11 if ( context != nullptr ){ but I don't think that'll make a difference just yet. You may also be able to manually close the socket if you get an onClose event.

Will think on it more–apologies the libraries are so out of date!