Commit 6db6e096 authored by Milian Wolff's avatar Milian Wolff
Browse files

Fix UB due to access of partially destroyed object in ~UiController

Fixes UBSAN warning:

```
/home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/uicontroller.cpp:232:57: runtime error: member call on address 0x60400043c250 which does not point to an object of type 'UiController'
0x60400043c250: note: object is of type 'Sublime::Controller'
 9c 00 00 25  b8 10 ee ba 89 7f 00 00  20 ec 0f 00 80 60 00 00  80 2a 63 00 60 60 00 00  e8 c0 76 bb
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for 'Sublime::Controller'
    #0 0x7f89c8d7c300 in operator() /home/milian/projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/uicontroller.cpp:232
```
parent 07902e14
......@@ -234,7 +234,12 @@ UiController::UiController(Core *core)
setupActions();
}
UiController::~UiController() = default;
UiController::~UiController()
{
// disconnect early to prevent UB due to accessing partially destroyed UiController
// in the focusChanged handler above
disconnect(qApp, nullptr, this, nullptr);
}
void UiController::setupActions()
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment