Disable ImageExpirationPool during testing (#4363)
* Disable ImageExpirationPool during testing * Update CHANGELOG.md --------- Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -19,6 +19,14 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#ifdef CHATTERINO_TEST
|
||||
// When running tests, the ImageExpirationPool destructor can be called before
|
||||
// all images are deleted, leading to a use-after-free of its mutex. This
|
||||
// happens despite the lifetime of the ImageExpirationPool being (apparently)
|
||||
// static. Therefore, just disable it during testing.
|
||||
# define DISABLE_IMAGE_EXPIRATION_POOL
|
||||
#endif
|
||||
|
||||
namespace chatterino {
|
||||
namespace detail {
|
||||
template <typename Image>
|
||||
@@ -105,6 +113,8 @@ private:
|
||||
// forward-declarable function that calls Image::getEmpty() under the hood.
|
||||
ImagePtr getEmptyImagePtr();
|
||||
|
||||
#ifndef DISABLE_IMAGE_EXPIRATION_POOL
|
||||
|
||||
class ImageExpirationPool
|
||||
{
|
||||
private:
|
||||
@@ -131,4 +141,6 @@ private:
|
||||
std::mutex mutex_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user