Add DockWidget::aboutToDelete

Relying on QObject::destroyed might not be a good idea, fixes the
following ASAN issue:

```
SideBar.cpp:80:22: runtime error: downcast of address 0x6040005c8b90
which does not point to an object of type 'DockWidget'
0x6040005c8b90: note: object is of type 'QObject'
 00 00 00 00  88 64 e7 43 3f 7f 00 00  a0 ff 0e 00 80 60 00 00
70 81 0c 00 c0 60 00 00  01 be be be
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'QObject'
```
This commit is contained in:
Waqar Ahmed
2022-06-22 19:16:46 +05:00
parent cc918c5195
commit 4ba58ac1be
4 changed files with 6 additions and 8 deletions

View File

@@ -58,6 +58,7 @@ DockWidget::DockWidget(View *view, const QString &name, DockWidgetOptions option
DockWidget::~DockWidget()
{
Q_EMIT aboutToDelete(this);
DockRegistry::self()->unregisterDockWidget(this);
delete d;
}