Files
qt-creator/src/plugins/languageclient/languageclientutils.cpp
Jarek Kobus b62fbe3ab9 Fix a crash when setting up toolbar editor actions
LanguageClient::updateEditorToolBar() contained the static
hashes that were keeping raw pointers to different
objects. However, the lifetime of these objects wasn't
controlled, so it could happen that we were operating
on dangling pointers.

In fact, like in the bugreport, some text editor widget could have
been deleted (together with his outline action), while later another
one (coincidently with the same address) could have appeared.
The old mapped widget still pointed to the removed action
so we crash.

Instead of keeping a static hashes we attach the custom
child object to the widget and keep there QPointers to all objects
we are interested in.

Fixes: QTCREATORBUG-26588
Change-Id: I335d9848ea85372baf3328772f0a249cee242dcd
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-19 12:29:49 +00:00

13 KiB