diff --git a/senseApis/xcbXorg/xcbXorg.cpp b/senseApis/xcbXorg/xcbXorg.cpp index 06ad20e..802d398 100644 --- a/senseApis/xcbXorg/xcbXorg.cpp +++ b/senseApis/xcbXorg/xcbXorg.cpp @@ -497,11 +497,11 @@ int xcbXorg_detachDeviceReq(const hk::device::SenseDeviceSpec &spec) [](const auto& param) { return param.first == "screen"; }); std::cerr << __func__ << ": Device not attached: " - << "display=" << (displayIt != spec.providerParams.end() - ? displayIt->second : "not specified") - << ", screen=" << (screenIt != spec.providerParams.end() - ? screenIt->second : "not specified") - << ", selector=" << spec.deviceSelector << "\n"; + << "display=" << (displayIt != spec.providerParams.end() + ? displayIt->second : "not specified") + << ", screen=" << (screenIt != spec.providerParams.end() + ? screenIt->second : "not specified") + << ", selector=" << spec.deviceSelector << "\n"; return 0; } @@ -514,10 +514,11 @@ int xcbXorg_detachDeviceReq(const hk::device::SenseDeviceSpec &spec) int newCount = --it->connection->refCount; // If no more references, close the connection - if (newCount == 0) { + if (newCount == 0) + { XcbConnection::connections.erase(id); std::cout << "Closed X server connection (display=" - << id.display << ", screen=" << id.screen << ")\n"; + << id.display << ", screen=" << id.screen << ")\n"; } attachedDevices.erase(it);