PDA

View Full Version : Qwt with multiaxes support - bug?



Khaine
13th April 2016, 21:25
It looks like there is some kind of bug when we use setAxesCount to set lower number of axes:

https://s18.postimg.org/n6iwu176h/bug.jpg (https://s18.postimg.org/n6iwu176h/bug.jpg)posted image (https://s18.postimg.org/n6iwu176h/bug.jpg/)

Looks like updateAxes method wants to get axis with ID 11. The problem is - axis with this ID doesn't exist anymore, as axes at position 1 are set to 1 (from 27). Curve with ID 11 was there before and was attached to this axis, but it was detached before I set new axes count. When I just set these axes invisible without setAxesCount(1,1) it's all good and stable.

Crash is most likely caused by updateAxes. But replot() also calls for updateAxes(), so after we change setAxisCount to less than before we cannot safely replot. Maybe I do some kind of mistake somewhere, but I'm pretty sure that updateAxes calls for non-existant axis to update.

I also discovered that if I delete curve attached to axis entirely and create it again - it will work normally. Looks like detaching curve from plot does not detach it from axis inside plot, and somehow keeps it's ID alive while axis itself is acually gone. It's just my observation though.