Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SandwichDB move ctor issue #14

Closed
ony opened this issue Nov 3, 2014 · 1 comment
Closed

SandwichDB move ctor issue #14

ony opened this issue Nov 3, 2014 · 1 comment
Labels
Milestone

Comments

@ony
Copy link
Owner

ony commented Nov 3, 2014

Wrong move ctor for SandwichD:

auto foo = SandwichDB();
// foo.meta.sandwich points to foo
foo->Open(/*...*/);
auto boo = std::move(foo);
// boo.meta.sandwich points to *old* foo

Because meta copied as is instead of being re-created in new place it will refer to freed memory used for old SandwichDB.

@ony ony added the bug label Nov 3, 2014
@ony ony added this to the v0.1.x milestone Nov 3, 2014
@ony ony added the ready label Nov 3, 2014
@ony
Copy link
Owner Author

ony commented Nov 3, 2014

Unit-test for both gcc 4.7 and 4.8:

TEST(Simple, sandwich_move_issue14)
{
    auto db = std::move(leveldb::SandwichDB<leveldb::MemoryDB> {});
    (void) db.use("alpha");
}

ghost pushed a commit that referenced this issue Nov 3, 2014
Expose and fix github issue #14
@ony ony closed this as completed Nov 3, 2014
@ony ony removed the ready label Nov 3, 2014
@ony ony assigned ghost Nov 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant