[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Leak in MappedType code?
From:       Nyall Dawson <nyall.dawson () gmail ! com>
Date:       2018-01-28 8:20:40
Message-ID: CAB28Asi4K1qtL6ZHtU7x6xH81JV4Gw7=1LgXZ9RN3Gziikwo7g () mail ! gmail ! com
[Download RAW message or body]

Hi list,

I'm seeing a leak when using the MappedType code for a class based on
QVector< QVariant >. The code in question is almost an exact copy of
the PyQt QVector code:

%ConvertFromTypeCode
  // Create the list.
  PyObject *l;

  if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
    return NULL;

  // Set the list elements.
  for ( int i = 0; i < sipCpp->size(); ++i )
  {
    QVariant *v = new QVariant( sipCpp->at( i ) );
    PyObject *tobj;

    if ( ( tobj = sipConvertFromNewType( v, sipType_QVariant,
sipTransferObj ) ) == NULL )
    {
      Py_DECREF( l );
      delete v;

      return NULL;
    }

    PyList_SET_ITEM( l, i, tobj );
  }

  return l;
%End

Using sip 4.19.5, Qt 5.9.2 and Python 3.6.3 I see a leak with this
code - yet with the exact same code on Qt 4.7 and Python 2.7.14 I see
no leak.

Any idea what's happening here?

Nyall
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic