Hi,
I have had a variety of serious memory corruption errors with QCustomPlot, which I eventually realised are due to how the OpenGL support is managed.
I am using QCustomPlot from my package manager, and in a nutshell, because all the GL support is `ifdef`ed out, if the library is built with GL support but the user-programmer does not define the same macros, the object size has changed between the header seen by the compiler for my project using the library and existing solib, and we get lots of nasty problems like use-after-free and sporadic crashes in unrelated places. setOpenGl() prints out an error message if the library was not built with support, however this not really a runtime enabling/disabling as the preprocessor definitions must match between the library and the project consuming it.
Please can you consider refactoring how this is managed so that it may truly be switched on and off at runtime without object layout inconsistencies? Personally I feel there is also rather a lot crammed in one file/class, and it might be better to delegate the rendering itself to a subobject, but, admittedly, I haven't interfaced with GL via Qt that much and would be happy to let that slide, but that is how I would approach this. If I end up using this regularly then I may be able to provide a patch.
Thanks