-DPLPLOT_USE_QT5=ON is an experimental option that builds and links the qt device against Qt5 (as opposed to the more usual Qt4) software. For both Qt5.3.1 and Qt5.3.2 that are epa_built on Linux (Debian stable), exiting the qtwidgets device for any standard example or exiting the qt_example C++ example generates invalid read errors according to valgrind. Valgrind also shows no other memory management issues for qtwidgets including no issues at all for exiting cursor mode for standard example 1 in locate mode. In contrast to that result, qt_example does generate invalid reads and other memory management errors according to valgrind when exiting the OK button that is deployed for that example in cursor mode. Also, for at least one configuration on Linux (non-dynamic devices) the memory management issues on exit from qt_example generate a segfault, and because invalid reads are a serious memory managment issue, that same segfault result could arise by accident for qtwidgets and/or qt_example for any other build configuration
or platform.
In other words, the combination of qt device driver and the Qt5 software that you get with -DPLPLOT_USE_QT5=ON is just not reliable at the moment from the memory management perspective, and I don't know whether the fault lies with Qt5 software or in the way that our qt device calls the Qt libraries (which currently is the same for both Qt4 and Qt5, but which might have to be changed for the latter case to get more reliable results).