QGCoder / qgcoder

An interactive G-code editing GUI.
GNU General Public License v2.0
19 stars 4 forks source link

Use QGCodeEditor view widget. #6

Closed koppi closed 8 years ago

koppi commented 8 years ago

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

ArcEye commented 8 years ago

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. :smile:

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.