Commit 75e78c6 1 parent 93f6d40 commit 75e78c6 Copy full SHA for 75e78c6
File tree 2 files changed +9
-2
lines changed
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ class Grouping
188
188
{}
189
189
#endif
190
190
191
- FileImpl::FileImpl (std::shared_ptr<FileCompound> _zimFile)
191
+ FileImpl::FileImpl (std::shared_ptr<FileCompound> _zimFile) try
192
192
: zimFile (_zimFile),
193
193
zimReader (makeFileReader (zimFile)),
194
194
direntReader (new DirentReader (zimReader)),
@@ -265,6 +265,9 @@ class Grouping
265
265
m_byTitleDirentLookup.reset (new ByTitleDirentLookup (mp_titleDirentAccessor.get ()));
266
266
267
267
readMimeTypes ();
268
+ } catch (...) {
269
+ getClusterCache ().drop_all ([=](const std::tuple<FileImpl*, cluster_index_type>& key) {return std::get<0 >(key) == this ;});
270
+ throw ;
268
271
}
269
272
270
273
FileImpl::~FileImpl () {
Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ class ZimArchive: public testing::Test {
50
50
zim::set_cluster_cache_max_size (CLUSTER_CACHE_SIZE);
51
51
ASSERT_EQ (zim::get_cluster_cache_current_size (), 0 );
52
52
}
53
+ void TearDown () override {
54
+ ASSERT_EQ (zim::get_cluster_cache_current_size (), 0 );
55
+ }
53
56
};
54
57
55
58
using TestContextImpl = std::vector<std::pair<std::string, std::string> >;
@@ -669,7 +672,8 @@ class CapturedStderr
669
672
#define EXPECT_BROKEN_ZIMFILE (ZIMPATH, EXPECTED_STDERROR_TEXT ) \
670
673
CapturedStderr stderror; \
671
674
EXPECT_FALSE (zim::validate(ZIMPATH, checksToRun)); \
672
- EXPECT_EQ (EXPECTED_STDERROR_TEXT, std::string(stderror)) << ZIMPATH;
675
+ EXPECT_EQ (EXPECTED_STDERROR_TEXT, std::string(stderror)) << ZIMPATH; \
676
+ ASSERT_EQ (zim::get_cluster_cache_current_size(), 0 );
673
677
674
678
#define TEST_BROKEN_ZIM_NAME (ZIMNAME, EXPECTED ) \
675
679
for (auto & testfile: getDataFilePath(ZIMNAME)) {EXPECT_BROKEN_ZIMFILE (testfile.path , EXPECTED)}
You can’t perform that action at this time.
0 commit comments