Tags: mkrupcale/libpqxx
Tags
In CMake, prefer CMake's config headers. Fixes jtv#178. Sometimes people experienced strange build problems when building with CMake, where libpqxx seemed to be compiled for a different C++ version than the one for which it was configured. This seems to happen in out-of-tree builds when the source tree has the configuration headers (`include/pqxx/config-*-*.h`), generated by the native autoconf-based build. The CMake build would generate similar config headers in the build tree, but when actually compiling, the build preferred the autoconf-generated config headers over the CMake-generated ones. This fixes that by reordering the include directories as they are added.
Fix/work around notice processor lifetime bug. Fixes jtv#172. Fixes jtv#173. Test 93 crashed with some compilers, but not with others. This was a nasty one. Turns out that libpq keeps a pointer to your connection's notice processor in each result object which you obtain from that same connection. And so, if you keep a result object alive in memory after closing its connection, the notice processor may get called after the connection object was destroyed. A libpqxx connection sets a notice processor which walks the connection's list of error handlers. And if the connection object no longer exists, that list will be gone as well! Clearing the notice processor when closing a connection turned out not to be enough. The result object still has a copy of the pointer. Fixing this is hard. It might be possible to keep a global data structure to track which connections are still alive, but it's costly and could run into synchronisation problems. So, I did two things about it: First, I register the libpqxx notice processor only when a connection actually has an error handler. If not, there's nothing for it to do anyway. This part fixes test 93. You won't have to worry about the whole thing unless you install custom error handlers. Second, I documented the hazard. Mainly in the error-handlers documentation: "if you do this, there's an additional rule you will have to follow." But I also mentioned it briefly in the introductory Markdown documentation.
PreviousNext