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

QgsPoint() constructor is ill-behaved on python #34557

Closed
olivierdalang opened this issue Feb 19, 2020 · 0 comments · Fixed by #34578
Closed

QgsPoint() constructor is ill-behaved on python #34557

olivierdalang opened this issue Feb 19, 2020 · 0 comments · Fixed by #34578
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! PyQGIS Related to the PyQGIS API

Comments

@olivierdalang
Copy link
Contributor

Describe the bug

The QgsPoint() constructor crashes QGIS if given wrong arguments instead of raising a TypeError.

This happens for instance if trying to use the inexistant QgsPoint(QgsPoint p) (instead of QgsPoint(QgsPointXY p)).

It seems to also happen with other invalid arguments (I tried with a string).

The error was reproduced by multiple users (see QGEP/QGEP#546).

How to Reproduce

In the QGIS python console, type one of

point_a = QgsPoint(10,20)
point_b = QgsPoint(point_a)

or

point_a = QgsPoint('of course you dont like strings')

And it freezes and crashes.

QGIS and OS versions

QGIS 3.10.2
QGIS code revision d4cd3cf
Compiled against Qt 5.11.2
Running against Qt 5.11.2

Additional context

Crash dump :

Crash ID: 4f80db0c784b9e0b969887a03450fdc6d8e4342b


Stack Trace


init_type_QgsPoint sip_corepart1.cpp:47370
PyObject_FastCallKeywords :
PyObject_FastCallKeywords :
PyMethodDef_RawFastCallKeywords :
PyEval_EvalFrameDefault :
PyEval_EvalCodeWithName :
PyImport_Import :
PyImport_Import :
PyMethodDef_RawFastCallKeywords :
PyMethodDef_RawFastCallKeywords :
PyEval_EvalFrameDefault :
PyMethodDef_RawFastCallKeywords :
PyEval_EvalFrameDefault :
PyEval_EvalCodeWithName :
PyMethodDef_RawFastCallKeywords :
PyEval_EvalFrameDefault :
PyEval_EvalCodeWithName :
PyMethodDef_RawFastCallKeywords :
PyEval_EvalFrameDefault :
PyMethodDef_RawFastCallKeywords :
PyEval_EvalFrameDefault :
PyMethodDef_RawFastCallKeywords :
PyEval_EvalFrameDefault :
PyFunction_FastCallDict :
PyMethodDef_RawFastCallDict :
PyObject_Call :
PyInit_sip :
PyInit_Qsci :
QWidget::event :
QFrame::event :
QAbstractScrollArea::event :
PyInit_Qsci :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify qgsapplication.cpp:418
QCoreApplication::notifyInternal2 :
QSizePolicy::QSizePolicy :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify qgsapplication.cpp:418
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processKeyEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
UserCallWinProcCheckWow :
DispatchMessageWorker :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main main.cpp:1598
BaseThreadInitThunk :
RtlUserThreadStart :




QGIS Info
QGIS Version: 3.10.2-A Coru�a
QGIS code revision: d4cd3cfe5a
Compiled against Qt: 5.11.2
Running against Qt: 5.11.2
Compiled against GDAL: 3.0.3
Running against GDAL: 3.0.4



System Info
CPU Type: x86_64
Kernel Type: winnt
Kernel Version: 10.0.17763
@olivierdalang olivierdalang added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Feb 19, 2020
@gioman gioman added the PyQGIS Related to the PyQGIS API label Feb 19, 2020
@elpaso elpaso self-assigned this Feb 20, 2020
elpaso added a commit to elpaso/QGIS that referenced this issue Feb 20, 2020
nyalldawson pushed a commit to nyalldawson/QGIS that referenced this issue Feb 22, 2020
nyalldawson pushed a commit that referenced this issue Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! PyQGIS Related to the PyQGIS API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants