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

Heap delete error when entity goes out of scope #144

Open
UHSL-Marcus opened this issue Jun 2, 2020 · 1 comment
Open

Heap delete error when entity goes out of scope #144

UHSL-Marcus opened this issue Jun 2, 2020 · 1 comment

Comments

@UHSL-Marcus
Copy link

I am running this in a test program:

int main()
{
    dds::domain::DomainParticipant dp1(dds::core::null);
    {
        dds::domain::DomainParticipant dp2(0); //Creates a domain participant on domain 0

        dp1 = dp2; //Copies reference to dp2 into dp1, both references now point to the same class instance
    }

    std::cin.get();
}

However as the program exits, after a button is pressed, a break point is hit on line 676 of memory.

// CLASS TEMPLATE _Ref_count
template <class _Ty>
class _Ref_count : public _Ref_count_base { // handle reference counting for pointer without deleter
public:
    explicit _Ref_count(_Ty* _Px) : _Ref_count_base(), _Ptr(_Px) {}

private:
    virtual void _Destroy() noexcept override { // destroy managed resource
        delete _Ptr; <---- This Line
    }

    virtual void _Delete_this() noexcept override { // destroy self
        delete this;
    }

    _Ty* _Ptr;
};

The exception "A heap has been corrupted" is thrown when trying to continue execution.

I built from source using the latest CYGWin on windows 10.

@vivekpandey02
Copy link

Hi UHSL-Marcus,

I tried reproducing this issue but i didn't get any such error.

With best regards,
Vivek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants