File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1313
1414namespace qs ::i3::ipc {
1515
16- I3IpcListener::~I3IpcListener () { delete this ->i3Ipc ; }
16+ I3IpcListener::~I3IpcListener () { this ->freeI3Ipc () ; }
1717
1818void I3IpcListener::onPostReload () { this ->startListening (); }
1919
@@ -27,7 +27,8 @@ void I3IpcListener::setSubscriptions(QList<QString> subscriptions) {
2727}
2828
2929void I3IpcListener::startListening () {
30- if (this ->i3Ipc != nullptr || this ->mSubscriptions .isEmpty ()) return ;
30+ this ->freeI3Ipc ();
31+ if (this ->mSubscriptions .isEmpty ()) return ;
3132
3233 this ->i3Ipc = new I3Ipc (this ->mSubscriptions );
3334
@@ -40,4 +41,9 @@ void I3IpcListener::startListening() {
4041
4142void I3IpcListener::receiveEvent (I3IpcEvent* event) { emit this ->ipcEvent (event); }
4243
44+ void I3IpcListener::freeI3Ipc () {
45+ delete this ->i3Ipc ;
46+ this ->i3Ipc = nullptr ;
47+ }
48+
4349} // namespace qs::i3::ipc
Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ class I3IpcListener: public PostReloadHook {
5959 void startListening ();
6060 void receiveEvent (I3IpcEvent* event);
6161
62+ void freeI3Ipc ();
63+
6264 QList<QString> mSubscriptions ;
6365 I3Ipc* i3Ipc = nullptr ;
6466};
You can’t perform that action at this time.
0 commit comments