QGCoder/qgcoder

Use QGCodeEditor view widget.

koppi opened this issue · 1 comments

koppi commented

Replace editor.cpp and high.cpp with QGCodeEditor widget, see: https://github.com/QGCoder/QGCodeEditor

This is implemented, but I was being plagued for days by intermittent segfaults
*** Error in 'gcoder' : Double free or corruption (out) , {address} ***

These would occur at startup and / or at exit and debugging was not leading to any useful location for an error.

I read somewhere about a similar problem, specific to Qt, which appeared related to the base class's implementation of a non virtual destructor.

By re-implementing the destructor of the QGCodeEditor widget, as virtual ~QGCodeEditor()
I appear to removed this problem. 😄

The widget now loads the first 200 lines of any code sent to it and then caches the remainder into a QStringList, from where internal line updates trigger further code additions in blocks of < 100 lines, until completed.

This results in the same performance as previously, ie now takes 5 secs approx to render 10,000 line gcode into editor AND viewer, instead of 30 secs for editor alone.