Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cb1kenobi committed Jul 16, 2024
1 parent 8a9b876 commit 03d53f9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# v3.0.0

* BREAKING CHANGE: Require Node.js 18.17 or newer
* feat: Support for arm/arm64
* fix: Fixed order of child key events when parent key is deleted
* BREAKING CHANGE: Require Node.js 18.17 or newer.
* feat: Support for arm/arm64.
* fix: Fixed order of child key events when parent key is deleted.
* fix: Fixed seg fault during cleanup that occurs when using winreglib in a
worker.
* fix: Fixed bug where the Windows Registry worker thread was being spawned
when adding the first listener. The idea was don't spawn the thread until
there was a listener, however thread shutdown is async and not worth the
hassle in a destructor, so now the background thread is always running.

# v2.0.4 (July 2, 2024)

Expand Down
14 changes: 8 additions & 6 deletions src/watchman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ void Watchman::config(const std::wstring& key, napi_value listener, WatchAction
}
}

// if we have any active listeners and the number of listeners changed,
// then signal the refresh
if (afterCount > 0 && beforeCount != afterCount) {
LOG_DEBUG_THREAD_ID("Watchman::config", L"Signaling refresh event")
::SetEvent(refresh);
Expand Down Expand Up @@ -203,12 +205,12 @@ void Watchman::dispatch() {
* Prints the watcher tree for debugging.
*/
void Watchman::printTree() {
// std::wstringstream wss(L"");
// std::wstring line;
// root->print(wss);
// while (std::getline(wss, line, L'\n')) {
// WLOG_DEBUG("Watchman::printTree", line)
// }
std::wstringstream wss(L"");
std::wstring line;
root->print(wss);
while (std::getline(wss, line, L'\n')) {
WLOG_DEBUG("Watchman::printTree", line)
}
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/watchman.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "winreglib.h"
#include "watchnode.h"
#include <deque>
#include <functional>
#include <memory>
#include <mutex>
#include <thread>
Expand Down
1 change: 0 additions & 1 deletion src/watchnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ void WatchNode::removeListener(napi_value listener) {
* Closes this node's registry key handle and its subkey's key handles.
*/
void WatchNode::unload(CallbackQueue* pending) {
LOG_DEBUG_1("WatchNode::unload", L"Checking subkeys under \"%ls\" hkey", name.c_str())
for (auto const& it : subkeys) {
it.second->unload(pending);
}
Expand Down

0 comments on commit 03d53f9

Please sign in to comment.