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

MatOfT dispose problem #379

Closed
VadCher opened this issue Sep 5, 2017 · 3 comments
Closed

MatOfT dispose problem #379

VadCher opened this issue Sep 5, 2017 · 3 comments
Labels
bug Something isn't working

Comments

@VadCher
Copy link

VadCher commented Sep 5, 2017

Hi.

When we creat Mat<TElem, TInherit> fom anothe Mat and then dispose one - memory dealoceted two times:
1 - when disposing Mat<TElem, TInherit> class
2 - when disposing sourceMat (when GC working)

@VShawn
Copy link

VShawn commented Sep 5, 2017

you are right
here is the case:

        Mat newm = img;                   //work well
        newm.Release();
        img.Release();

        //Mat newm = img.Clone();             //work well
        //img.Release();
        //newm.Release();

        //Mat newm = new Mat(img);          //throw exception when return

        //Mat newm = new Mat(img.Clone());  //throw exception when return

        return;

@VadCher
Copy link
Author

VadCher commented Sep 5, 2017

It is anothe case

var sourceMat = new Mat(10, 20, MatType.CV_64FC1);
var doubleMat = new MatOfDouble(sourceMat);
sourceMat = null;
doubleMat.Dispose(); // after it when GC will working program broken

@shimat shimat closed this as completed in fe3b036 Sep 9, 2017
@shimat
Copy link
Owner

shimat commented Sep 9, 2017

Thanks 👍 This is fixed by fe3b036

@shimat shimat added the bug Something isn't working label Sep 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants