ofxLibwebsockets icon indicating copy to clipboard operation
ofxLibwebsockets copied to clipboard

libwebsocket_context_destroy crashes

Open pierdr opened this issue 9 years ago • 1 comments

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?

pierdr avatar Sep 19 '16 21:09 pierdr

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!

robotconscience avatar Sep 19 '16 21:09 robotconscience