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

python bindings for legendInterface().groupLayerRelationship() gives segfault #16901

Closed
qgib opened this issue Jun 13, 2013 · 5 comments
Closed
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Plugins
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Jun 13, 2013

Author Name: Etienne Tourigny (@etiennesky)
Original Redmine Issue: 8061
Affected QGIS version: master
Redmine category:python_plugins
Assignee: Nathan Woodrow


I have a python plugin which uses legendInterface().groupLayerRelationship() and when trying to port it to new spiv2 api I get this error.

I can reproduce without the plugin using the python console.

  • start qgis with no layers
  • open python console
  • type 'iface.legendInterface().groups()' - returns an empty list
  • type 'iface.legendInterface().groupLayerRelationship()' - returns an empty list
  • add a map layer
  • type 'iface.legendInterface().groups()' - returns an empty list
  • type 'iface.legendInterface().groupLayerRelationship()' - segfault

segfault occurs here
0x00007fffcff70db8 in convertFrom_QList_0600QPair_0100QString_0600QList_0100QString (sipCppV=0x1da83a0, sipTransferObj=0x0) at /data/src/qgis/qgis-master/python/core/conversions.sip:1450
1450 PyObject *t1obj = sipConvertFromNewInstance(new QString(sipCpp->at(i).second.at(j)), sipClass_QString, sipTransferObj);

following is a log and backtrace (output in qgslegend.cpp was added by me)

I have assigned Nathan as he has been leading the sipV2 effort

Debug: src/core/qgsmaprenderer.cpp: 723: (render) Rendering completed in (seconds): 0.004
Debug: src/app/legend/qgsapplegendinterface.cpp: 133: (groupLayerRelationship) returning mLegend->groupLayerRelationship()
Debug: src/app/legend/qgslegend.cpp: 2234: (groupLayerRelationship) returning list with 1 items
Debug: src/app/legend/qgslegend.cpp: 2237: (groupLayerRelationship) k=[] #v=[1]
Debug: src/app/legend/qgslegend.cpp: 2239: (groupLayerRelationship) s=[landsat20130613173433257]

Program received signal SIGSEGV, Segmentation fault.
0x00007fffcff70db8 in convertFrom_QList_0600QPair_0100QString_0600QList_0100QString (sipCppV=0x1da83a0, sipTransferObj=0x0) at /data/src/qgis/qgis-master/python/core/conversions.sip:1450
1450	        PyObject *t1obj = sipConvertFromNewInstance(new QString(sipCpp->at(i).second.at(j)), sipClass_QString, sipTransferObj);
(gdb) 
(gdb) bt
#_0  0x00007fffcff70db8 in convertFrom_QList_0600QPair_0100QString_0600QList_0100QString (sipCppV=0x1da83a0, sipTransferObj=0x0) at /data/src/qgis/qgis-master/python/core/conversions.sip:1450
#_1  0x00007fffd119f2d1 in ?? () from /usr/lib/python2.7/dist-packages/sip.so
#_2  0x00007fffcf049034 in meth_QgsLegendInterface_groupLayerRelationship (sipSelf=0x26e70e0, sipArgs=0x1568050) at /data/src/qgis/qgis-master/build-debug/python/gui/sipguipart3.cpp:1093
#_3  0x00007fffd1402d72 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#_4  0x00007fffd1403c38 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#_5  0x00007fffd1403d72 in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
#_6  0x00007fffd1401c3a in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#_7  0x00007fffd1403c38 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#_8  0x00007fffd140182e in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#_9  0x00007fffd1403c38 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#_10 0x00007fffd140182e in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#_11 0x00007fffd1402e1b in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#_12 0x00007fffd1402e1b in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#_13 0x00007fffd1403c38 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#_14 0x00007fffd1459c76 in ?? () from /usr/lib/libpython2.7.so.1.0
#_15 0x00007fffd14d31be in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#_16 0x00007fffd15374e0 in ?? () from /usr/lib/libpython2.7.so.1.0
#_17 0x00007fffd14d31be in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#_18 0x00007fffd14d3ac7 in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.7.so.1.0
#_19 0x00007fffd11a2692 in ?? () from /usr/lib/python2.7/dist-packages/sip.so
#_20 0x00007fffd0550410 in ?? () from /usr/lib/python2.7/dist-packages/PyQt4/QtGui.so
#_21 0x00007fffcd5c9572 in ?? () from /usr/lib/python2.7/dist-packages/PyQt4/Qsci.so
#_22 0x00007ffff2b9c8db in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_23 0x00007ffff2f4bb66 in QFrame::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_24 0x00007ffff2fcb82b in QAbstractScrollArea::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_25 0x00007fffcd15e2e0 in QsciScintilla::event(QEvent*) () from /usr/lib/libqscintilla2.so.8
#_26 0x00007fffcd624d6b in ?? () from /usr/lib/python2.7/dist-packages/PyQt4/Qsci.so
#_27 0x00007ffff2b4ce9c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_28 0x00007ffff2b51e84 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_29 0x00007ffff4941ffe in QgsApplication::notify (this=0x7fffffffd220, receiver=0x25f1780, event=0x7fffffffbd10) at /data/src/qgis/qgis-master/src/core/qgsapplication.cpp:241
#_30 0x00007ffff37a556e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#_31 0x00007ffff2bede79 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_32 0x00007ffff2bee2b1 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_33 0x00007ffff2bc9ed9 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_34 0x00007ffff2bf1fa2 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_35 0x00007fffef4b7ab5 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#_36 0x00007fffef4b7de8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#_37 0x00007fffef4b7ea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#_38 0x00007ffff37d3bf6 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#_39 0x00007ffff2bf1c1e in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#_40 0x00007ffff37a42bf in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#_41 0x00007ffff37a4548 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#_42 0x00007ffff37a9708 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#_43 0x000000000054d408 in main (argc=1, argv=0x7fffffffd4f8) at /data/src/qgis/qgis-master/src/app/main.cpp:997
(gdb)


@qgib
Copy link
Contributor Author

qgib commented Jun 13, 2013

Author Name: Etienne Tourigny (@etiennesky)


this happens if there are groups or not


  • subject was changed from python bindings for legendInterface().groupLayerRelationship() gives segfault (when no groups present) to python bindings for legendInterface().groupLayerRelationship() gives segfault

@qgib
Copy link
Contributor Author

qgib commented Jun 13, 2013

Author Name: Salvatore Larosa (@slarosa)


Mine is just improvisation.

The attached patch should fix the problem !
(but I do not know if it breaks something else :-)))


  • 5863 was configured as fix_sip_QString.patch

@qgib
Copy link
Contributor Author

qgib commented Jun 13, 2013

Author Name: Alexander Bruy (@alexbruy)


Works fine here with latest master

@qgib
Copy link
Contributor Author

qgib commented Jun 14, 2013

Author Name: Etienne Tourigny (@etiennesky)


I am using python 2.7.3-0ubuntu7 and python-sip 4.13.3-2 in Linux Mint 14 (ubuntu quental), latest master.

The patch by Salvatore works for me. I will test further to make sure it doesn't break anything.

Alexandre: does it work for you after applying the patch? Are you using another sip/python version?

iface.legendInterface().groups()
[]
>>> iface.legendInterface().groupLayerRelationship()
[[u'', [u'lines20130614111717895']]]

@qgib
Copy link
Contributor Author

qgib commented Jun 17, 2013

Author Name: Salvatore Larosa (@slarosa)


Fixed in changeset "1f10010ebf064ce31a53af2917231bd9ac41e413".


  • status_id was changed from Open to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins Crash/Data Corruption labels May 24, 2019
@qgib qgib added this to the Version 2.0.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
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! Crash/Data Corruption Plugins
Projects
None yet
Development

No branches or pull requests

1 participant