Closed letsfindaway closed 1 year 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:
merged
Occasionally a crash occurs when zooming with the wheel. Here is a first stack trace of a crash: The reason here are illegal parameter values for
UBGraphicsAxes::setRect()
: This is caused by illegal values for themBounds
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: 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.