diff options
author | link2xt <link2xt@testrun.org> | 2020-10-27 02:44:13 +0300 |
---|---|---|
committer | link2xt <link2xt@testrun.org> | 2020-10-27 02:44:15 +0300 |
commit | 47cc6adab11958bcdd50bb24817f9429f1f566bb (patch) | |
tree | d3277e2669f91c8892d87eac3965dc7f0ea06a79 /eventemitter.h | |
parent | e84f17304ad0534e161346c22151f23e6577b75a (diff) | |
download | kdeltachat-47cc6adab11958bcdd50bb24817f9429f1f566bb.tar.gz kdeltachat-47cc6adab11958bcdd50bb24817f9429f1f566bb.zip |
Fix quitting the application
Event emitter should only be freed when it emits NULL.
Previously dc_accounts_event_emitter_unref() was called earlier then
needed, causing use-after-free. As a result, the application got stuck
waiting for event emitter thread to finish.
Diffstat (limited to 'eventemitter.h')
-rw-r--r-- | eventemitter.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/eventemitter.h b/eventemitter.h index 0b18a8e..21a8af1 100644 --- a/eventemitter.h +++ b/eventemitter.h @@ -17,6 +17,8 @@ class EventLoopThread : public QThread while((event = dc_accounts_get_next_event(m_eventEmitter))) { emit emitEvent(new DcEvent{event}); } + dc_accounts_event_emitter_unref(m_eventEmitter); + std::cout << "NO MORE EVENTS!" << std::endl; } public: @@ -44,7 +46,6 @@ public: ~DcAccountsEventEmitter(); Q_INVOKABLE void start(); - Q_INVOKABLE void stop(); Q_INVOKABLE void processEvent(DcEvent *event); signals: |