[sip] random crashes when using QMetaEnum

Denis Rouzaud denis.rouzaud at gmail.com
Tue Sep 8 13:39:58 BST 2020


Hi list,

For an enum (not scoped based), I am running this code:

for i in range(0, 100):
    idx =
QgsDataSourceUri.staticMetaObject.indexOfEnumerator(QgsDataSourceUri.SslMode.__name__)
    meta_enum = QgsDataSourceUri.staticMetaObject.enumerator(idx)
    print(meta_enum.isValid())
    sleep(.3)

I usually get a crash after 2 to 6 iterations.
Code is hereunder.

As far as I can tell, this happens to any version of SIP above 4.19.17 (not
tested under).

Cheers,
Denis

The enum is defined as follows:

class CORE_EXPORT QgsDataSourceUri

{

    Q_GADGET

  public:

    enum SslMode

    {

      SslPrefer,

      SslDisable,

      SslAllow,

      SslRequire,

      SslVerifyCa,

      SslVerifyFull

    };

    Q_ENUM( SslMode )

    QgsDataSourceUri();


The sip file:

class QgsDataSourceUri

{

%TypeHeaderCode

#include "qgsdatasourceuri.h"

%End

  public:

    static const QMetaObject staticMetaObject;

  public:

    enum SslMode

    {

      SslPrefer,

      SslDisable,

      SslAllow,

      SslRequire,

      SslVerifyCa,

      SslVerifyFull

    };

    QgsDataSourceUri();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200908/6ff3f8e7/attachment.htm>


More information about the PyQt mailing list