cancel
Showing results for 
Search instead for 
Did you mean: 

Using Graph Widget in Swipe Container causes Hard Fault

gfxfloro
Senior

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?

7 REPLIES 7
Martin KJELDSEN
Chief III

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
Senior

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
Chief III

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
Senior

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?

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
Senior

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

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.