Lisandro,

Once again, thank you!

I think I finally have a tricky question for you now however:

I have the OpenCV IplImage class wrapped as so:

####################################

cdef class IplImage:

    cdef c_cxcore.IplImage* thisptr

    #Convienience Functions

    def show(self):
    # a convienience function which displays the image in a new window
    # useful for debugging. window exits on keypress.
        c_highgui.cvNamedWindow('test', 1)
        c_highgui.cvShowImage('test', self.thisptr)
        c_highgui.cvWaitKey(0)
        c_highgui.cvDestroyWindow('test')

    def __dealloc__(self):
        c_cxcore.cvReleaseImage(&self.thisptr)


     # property access methods
     ....


def cvLoadImage(filename):
    cdef c_cxcore.IplImage* img = c_highgui.cvLoadImage(filename, 1)
    cdef IplImage pyimg = IplImage()
    pyimg.thisptr = img
    return pyimg
#############################




now in python, when i do something like this:

img = cvLoadImage('test1.bmp')
img.show()                                  <----- this works fine
img = cvLoadImage('test2.bmp')    <------ this also works
img.show()                                  <---------- I crash here



i'm thinking that python is calling my __dealloc__ and its somehow deleting
the new pointer out from under me


what do you think?

Chris
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to