mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 01:13:28 +08:00
Merge pull request #17841 from vpisarev:fixed_fs_dtor
* fixed issue #17412 * Update test_io.cpp
This commit is contained in:
parent
9b7b22ee0e
commit
4564b8a224
@ -1819,7 +1819,6 @@ void FileStorage::endWriteStruct()
|
|||||||
|
|
||||||
FileStorage::~FileStorage()
|
FileStorage::~FileStorage()
|
||||||
{
|
{
|
||||||
p.release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileStorage::open(const String& filename, int flags, const String& encoding)
|
bool FileStorage::open(const String& filename, int flags, const String& encoding)
|
||||||
|
@ -1772,4 +1772,20 @@ TEST(Core_InputOutput, FileStorage_open_empty_16823)
|
|||||||
EXPECT_EQ(0, remove(fname.c_str()));
|
EXPECT_EQ(0, remove(fname.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Core_InputOutput, FileStorage_copy_constructor_17412)
|
||||||
|
{
|
||||||
|
std::string fname = tempfile("test.yml");
|
||||||
|
FileStorage fs_orig(fname, cv::FileStorage::WRITE);
|
||||||
|
fs_orig << "string" << "wat";
|
||||||
|
fs_orig.release();
|
||||||
|
|
||||||
|
// no crash anymore
|
||||||
|
cv::FileStorage fs;
|
||||||
|
fs = cv::FileStorage(fname, cv::FileStorage::READ);
|
||||||
|
std::string s;
|
||||||
|
fs["string"] >> s;
|
||||||
|
EXPECT_EQ(s, "wat");
|
||||||
|
EXPECT_EQ(0, remove(fname.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
}} // namespace
|
}} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user