cancel
Showing results for 
Search instead for 
Did you mean: 

Bug found (and fixed) in touchgfx 4.15 and 4.16, AbstractDataGraph.cpp

VSimu.1
Associate III

Hi,

So far in AbstractDataGraph.cpp the library had:

namespace touchgfx
{
AbstractDataGraph::AbstractDataGraph(int16_t capacity)
    : dataScale(1), alpha(255), topPadding(0), leftPadding(0), rightPadding(0), bottomPadding(0),
      maxCapacity(capacity), usedCapacity(0), gapBeforeIndex(0), clickAction()

but it should be:

namespace touchgfx
{
AbstractDataGraph::AbstractDataGraph(int16_t capacity)
    : dataScale(1), alpha(255), topPadding(0), leftPadding(0), rightPadding(0), bottomPadding(0),
      maxCapacity(capacity), usedCapacity(0), gapBeforeIndex(0), clickAction(), dragAction()

i.e. the problem was that "dragAction" was never initialized and our application would crash. But not every time you dragged a Graph widget, but only sometimes (when you enter that screen and everything is initialized for maybe the 2nd or 3rd time, then with the wrong garbage data, it would crash)

Here is our stacktrack where it would always crash. dragAction->isValid() would be called, even though dragAction was never initialized. i.e. you are dereferencing an invalid pointer. The reason why the "!dragAction" check passed, was because dragAction had garbage data (i.e. it was not set to nullptr upon initialization i.e. it was never initialized).

Cheers

11 REPLIES 11

There will be a new function setPageIndicatorCenteredX(int16_t x) which will leave the y coordinate unaltered. This should satisfy your needs.

That sounds good. Also, in general I am very happy that the source code can be edited for small extensions to touchgfx that we can make on our own.