Skip to content

Commit

Permalink
Prevent undefined behaviour when an appender is deleted without being…
Browse files Browse the repository at this point in the history
… closed
  • Loading branch information
stephen-webb committed Jul 25, 2024
1 parent 824563d commit f7f8caa
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/cpp/filewatchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct FileWatchdog::FileWatchdogPrivate{
#if LOG4CXX_EVENTS_AT_EXIT
, atExitRegistryRaii([this]{stopWatcher();})
#endif
{}
{ stopWatcher(); }
/**
The name of the file to observe for changes.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/cpp/telnetappender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct TelnetAppender::TelnetAppenderPriv : public AppenderSkeletonPrivate
#if LOG4CXX_EVENTS_AT_EXIT
, atExitRegistryRaii([this]{stopAcceptingConnections();})
#endif
{}
{ stopAcceptingConnections(); }

int port;
ConnectionList connections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct SocketAppenderSkeleton::SocketAppenderSkeletonPriv : public AppenderSkele
#if LOG4CXX_EVENTS_AT_EXIT
, atExitRegistryRaii([this]{stopMonitor();})
#endif
{}
{ stopMonitor(); }

SocketAppenderSkeletonPriv(helpers::InetAddressPtr address, int defaultPort, int reconnectionDelay) :
AppenderSkeletonPrivate(),
Expand All @@ -54,7 +54,7 @@ struct SocketAppenderSkeleton::SocketAppenderSkeletonPriv : public AppenderSkele
#if LOG4CXX_EVENTS_AT_EXIT
, atExitRegistryRaii([this]{stopMonitor();})
#endif
{}
{ stopMonitor(); }

SocketAppenderSkeletonPriv(const LogString& host, int port, int delay) :
AppenderSkeletonPrivate(),
Expand All @@ -66,7 +66,7 @@ struct SocketAppenderSkeleton::SocketAppenderSkeletonPriv : public AppenderSkele
#if LOG4CXX_EVENTS_AT_EXIT
, atExitRegistryRaii([this]{stopMonitor();})
#endif
{}
{ stopMonitor(); }

/**
host name
Expand Down
1 change: 0 additions & 1 deletion src/test/cpp/net/telnetappendertestcase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class TelnetAppenderTestCase : public AppenderSkeletonTestCase
#endif
LOG4CXX_INFO(root, "Hello, World " << i);
}
appender->close();
}

};
Expand Down

0 comments on commit f7f8caa

Please sign in to comment.