letsfindaway / OpenBoard

I'm using this fork to contribute features and fixes to the upstream project. In order to create good pull requests, I'm rebasing my feature branches, squashing and reordering commits, etc. If you fork this repository be aware that my development branches may rewrite history without prior notice.
http://openboard.ch/
GNU General Public License v3.0
9 stars 0 forks source link

Crash when zooming scene with Axes #147

Closed letsfindaway closed 10 months ago

letsfindaway commented 10 months ago

Occasionally a crash occurs when zooming with the wheel. Here is a first stack trace of a crash: grafik The reason here are illegal parameter values for UBGraphicsAxes::setRect(): grafik This is caused by illegal values for the mBounds member variable, which is used as parameter. Looking further, all other members of the object contain unreasonable values.

The reason could be, that the connection to the lambda expression is not deleted when the object is deleted: https://github.com/letsfindaway/OpenBoard/blob/3251cc13c7287380c1157cfd20abb0d9b247cd2b/src/tools/UBGraphicsAxes.cpp#L75-L78 As no context parameter is given before the lambda expression, Qt does not know that it has to disconnect this connection when the object is deleted.

There might be other places with similar connections - I will scan through the code for such problems.

Here is however a totally different backtrace: grafik It also occurred during mouse wheel zooming.

I added debug output when an Axes object is deleted. This crash occurred immediately after deleting such an object, so it might actually be the reason.

letsfindaway commented 10 months ago

How to reproduce the problem:

As said above, it happens when a QGraphicsAxes object is deleted. But when does this happen? As one can see from the code, pressing the "Close" button on a tool only hides it. The object is not deleted. It is another question, why, but this is the current status with Axes, Ruler, Triangle, Protractor and Compass. But these objects are deleted when saving the scene. Here a copy of the scene is created, the copy is saved and then deleted, including all items.

So the steps to reproduce are as follows:

letsfindaway commented 10 months ago

merged