1.1 --- a/libfsserver/lib/pipes/pipe_pager.cc Sat Sep 11 01:32:34 2021 +0200
1.2 +++ b/libfsserver/lib/pipes/pipe_pager.cc Sat Sep 11 19:44:57 2021 +0200
1.3 @@ -60,11 +60,22 @@
1.4
1.5 void PipePager::close()
1.6 {
1.7 - _paging->detach();
1.8 + if (_paging == NULL)
1.9 + return;
1.10 +
1.11 + unsigned int attached = _paging->detach();
1.12
1.13 /* Notify the other endpoint. */
1.14
1.15 _paging->notify_others(_writing ? PipePaging::WRITER : PipePaging::READER, NOTIFY_PEER_CLOSED);
1.16 +
1.17 + /* Deallocate the paging coordinator if no other endpoints are active. */
1.18 +
1.19 + if (!attached)
1.20 + {
1.21 + delete _paging;
1.22 + _paging = NULL;
1.23 + }
1.24 }
1.25
1.26 /* Support paging. */