John Hunter skrev:
> On Tue, Jun 17, 2008 at 3:00 PM, Jörgen Stenarson
> <[EMAIL PROTECTED]> wrote:
>
>> I did a svn up and a clean rebuild but still the same error. The error
>> reminded me of the problems a while back when references to the
>> fontfiles were not released. So I have tried to look at the filehandles
>> using procexp but I cannot say if this is the problem, but I don't see
>> any explosion in open file handles. But the crash is so sudden I may not
>> be able to see this.
>>
>> Any thing else I can check at my end?
>
> I wonder if the reference counting in py_as_array is wrong. The most
> likely culprit is the new function in src/ft2font.cpp. Do we need an
> incref here? Joergen, does it help to comment out
> the PyArray_SimpleNewFromData line and replace it with the commented
> out block below it? I need to dig into the ownership and reference
> policy of these two funcs but I don't have time to do it now.
>
I tried this but it still crashes. Below is the change I did.
/Jörgen
Py::Object
FT2Image::py_as_array(const Py::Tuple & args) {
_VERBOSE("FT2Image::as_array");
args.verify_length(0);
npy_intp dimensions[2];
dimensions[0] = get_height(); //numrows
dimensions[1] = get_width(); //numcols
/*
PyArrayObject *A = (PyArrayObject *) PyArray_SimpleNewFromData(2,
dimensions, PyArray_UBYTE, _buffer);
*/
PyArrayObject *A = (PyArrayObject *) PyArray_FromDims(2, dimensions,
PyArray_UBYTE);
unsigned char *src = _buffer;
unsigned char *src_end = src + (dimensions[0] * dimensions[1]);
unsigned char *dst = (unsigned char *)A->data;
while (src != src_end) {
*dst++ = *src++;
}
return Py::asObject((PyObject*)A);
}
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users