Merge pull request #3143 from Carbenium/close-event-crash

Monitor: Don't segfault in closeEvent if mmap is already unmapped
This commit is contained in:
Isaac Connor 2021-02-08 15:32:38 -05:00 committed by GitHub
commit 4d0800151a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -1022,6 +1022,8 @@ bool Monitor::disconnect() {
close(map_fd);
map_fd = -1;
mem_ptr = nullptr;
shared_data = nullptr;
if ( purpose == CAPTURE ) {
if ( unlink(mem_file) < 0 ) {
@ -1065,8 +1067,7 @@ bool Monitor::disconnect() {
image_buffer = nullptr;
}
mem_ptr = nullptr;
shared_data = nullptr;
return true;
} // end bool Monitor::disconnect()