Skip to main content
gfxfloro
Associate III
November 12, 2019
Question

Using Graph Widget in Swipe Container causes Hard Fault

  • November 12, 2019
  • 5 replies
  • 1327 views

I'm trying to use the Graph Widget in a Swipe Container, so that when I to another screen, I have another plot running. On touching the container this causes a hard fault, from which I can't find out what is causing it.

The Fault Analyzer in the IDE shows a Precise data access violation with BFAR: 0x4404ea68, so it seems like there is a memory overflow, but I can't pinpoint the place it happens. Is there any way I can narrow it down?

This topic has been closed for replies.

5 replies

Martin KJELDSEN
Principal III
November 12, 2019

Let me just ask.

Could you break inside this function and inspect invalidatedArea? (width, height, x, y) - It's come to my attention that there may be an issue with this "example graph" code that's floating around where the width of the rect can become negative if the graph is not static but having its data heavily manipulated and perhaps when animating.

bool GraphLine::drawCanvasWidget(const Rect& invalidatedArea) const

/Martin

gfxfloro
gfxfloroAuthor
Associate III
November 12, 2019

How would I get there right before the crash? I tried to set breakpoints in the swipeContainer.cpp files, to get a break right when I touch the screen, but that doesn't seem to work.

Martin KJELDSEN
Principal III
November 12, 2019

Write a piece of code in ::drawCanvasWidget where you check if the width of rect is negative. You should never hit this. If you do, you may hardfault.

/Martin

gfxfloro
gfxfloroAuthor
Associate III
November 13, 2019

So it seems there wasn't a problem with the Graph Widget itself, but with adding an additional swipePage. I tried to do this in the my View.cpp after there was already a generated swipeContainer. Is it possble to add swipe pages after the generated container has already been added in the ViewBase.cpp?

Emil Damkjaer PETERSEN
ST Employee
November 15, 2019

Yes, you can add it with SwipeContainer.add(newPage), but if the page(container) is created in and added to the canvas in the designer, you have to remove it from the view before adding it to the Swipe Container with the function remove(newPage).

Emilmart
Associate III
March 3, 2021

I noticed that if the graph isn't inside a swipe control and that the user swipe on left the graph, it causes an hard fault

Michael K
Senior III
March 11, 2021

I think this was fixed in a recent touchgfx release, however what I did was I placed an empty container on top of the graph and set it as a clicklistener in the designer. That way any clicks or swipes would get "eaten" by the container and none would pass on towards the graph.

Embedded UI/UX Consulting: cadenza.design