[QGIS-Developer] Drag and drop to PostGIS crash

Nyall Dawson nyall.dawson at gmail.com
Tue May 30 14:39:11 PDT 2017


On 31 May 2017 at 03:07, Radim Blazek <radim.blazek at gmail.com> wrote:

> DD works within the browser now but not for layer with measures.

I guess this has never been implemented. Looking at
QgsPostgresConn::postgisWkbType, it's only got support for a very
limited range of WKB types (no curves, no m values, won't handle z
types (only 25d types) ). I think it should work ok after that
function is fixed.

> DD from layer tree to postgres/browser imports the layer (without measures) but:
> - the layer is removed from layer tree - intended?

Definitely not - I hit this too a week or so ago, and it's far from
ideal! QgsDockBrowserTreeView::dragEnterEvent/dragMoveEvent/dropEvent
has code which is supposed to force a copy action when dragging from
the layer tree, but something's broken there. Any ideas Martin?

> - QGIS crashes sometimes
>
> One traceback below, it crashed when DD failed. I think that the
> problem is that it is trying to show an error message which can only
> be done on main thread?
> The code which is run from QgsTaskManager should never interact with GUI?

That shouldn't be the case (unless there's a bug somewhere). It's true
that tasks should never interact with the GUI in their run()
implementation, but QgsTask::finished should only ever be called from
the main thread and it should be safe to do GUI operations there. From
your crash below it seems like it's crashing after
QgsVectorLayerExporterTask::errorOccurred is emitted - but that's only
ever done from QgsVectorLayerExporterTask::finished . Could you try
putting a temporary assert in QgsVectorLayerExporterTask::finished to
ensure that it's working as designed and being called from the main
thread?

Thanks!
Nyall


>
> #0  0x00007f844620f3c0 in QCoreApplication::notifyInternal2(QObject*,
> QEvent*) () from /home/radim/Qt/5.8/gcc_64/lib/libQt5Core.so.5
> (gdb) bt
> #0  0x00007f844620f3c0 in QCoreApplication::notifyInternal2(QObject*,
> QEvent*) () from /home/radim/Qt/5.8/gcc_64/lib/libQt5Core.so.5
> #1  0x00007f844625ea1e in QTimerInfoList::activateTimers() () from
> /home/radim/Qt/5.8/gcc_64/lib/libQt5Core.so.5
> #2  0x00007f844625f219 in ?? () from
> /home/radim/Qt/5.8/gcc_64/lib/libQt5Core.so.5
> #3  0x00007f843e5c9c5d in g_main_context_dispatch () from
> /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #4  0x00007f843e5c9f48 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #5  0x00007f843e5c9ffc in g_main_context_iteration () from
> /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #6  0x00007f844625fcbf in
> QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
> ()
>    from /home/radim/Qt/5.8/gcc_64/lib/libQt5Core.so.5
> #7  0x00007f844620d9ca in
> QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from
> /home/radim/Qt/5.8/gcc_64/lib/libQt5Core.so.5
> #8  0x00007f844a1e8a07 in QDialog::exec() () from
> /home/radim/Qt/5.8/gcc_64/lib/libQt5Widgets.so.5
> #9  0x00007f844d8e9c50 in QgsMessageViewer::showMessage
> (this=0x3e77be0, blocking=true)
>     at /home/radim/devel/qgis/src/gui/qgsmessageviewer.cpp:74
> #10 0x00007f844d8e9cbc in non-virtual thunk to
> QgsMessageViewer::showMessage(bool) ()
>     at /home/radim/devel/qgis/src/gui/qgsmessageviewer.cpp:81
> #11 0x00007f8419ec65d0 in QgsPGConnectionItem::handleDrop(QMimeData
> const*, QString const&)::$_5::operator()(int, QString const&) const
>     (this=0x2c65230, error=2, errorMessage=...) at
> /home/radim/devel/qgis/src/providers/postgres/qgspostgresdataitems.cpp:241
> #12 0x00007f8419ec64ae in
> QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1>,
> QtPrivate::List<int, QString const&>, void,
> QgsPGConnectionItem::handleDrop(QMimeData const*, QString
> const&)::$_5>::call(QgsPGConnectionItem::handleDrop(QMimeData const*,
> QString const&)::$_5&, void**) (f=..., arg=0x7ffcf04e7130) at
> /home/radim/Qt/5.8/gcc_64/include/QtCore/qobjectdefs_impl.h:137
> #13 0x00007f8419ec6471 in
> QtPrivate::Functor<QgsPGConnectionItem::handleDrop(QMimeData const*,
> QString const&)::$_5, 2>::call<QtPrivate::List<int, QString const&>,
> void>(QgsPGConnectionItem::handleDrop(QMimeData const*, QString
> const&)::$_5&, void*, void**) (f=...,
>     arg=0x7ffcf04e7130) at
> /home/radim/Qt/5.8/gcc_64/include/QtCore/qobjectdefs_impl.h:194
> #14 0x00007f8419ec6413 in
> QtPrivate::QFunctorSlotObject<QgsPGConnectionItem::handleDrop(QMimeData
> const*, QString const&)::$_5, 2, QtPrivate::List<int, QString const&>,
> void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*)
> (which=1, this_=0x2c65220,
>     r=0x3cfc3e0, a=0x7ffcf04e7130, ret=0x0) at
> /home/radim/Qt/5.8/gcc_64/include/QtCore/qobject_impl.h:168
> #15 0x00007f8446238746 in QMetaObject::activate(QObject*, int, int,
> void**) () from /home/radim/Qt/5.8/gcc_64/lib/libQt5Core.so.5
> #16 0x00007f844bf0347f in QgsVectorLayerExporterTask::errorOccurred
> (this=0x43be440, _t1=2, _t2=...)
>     at /home/radim/devel/qgis-build/src/core/moc_qgsvectorlayerexporter.cpp:147
> #17 0x00007f844bbb9b80 in QgsVectorLayerExporterTask::finished
> (this=0x43be440, result=false)
>     at /home/radim/devel/qgis/src/core/qgsvectorlayerexporter.cpp:508
> #18 0x00007f844bad71e7 in QgsTaskManager::taskStatusChanged
> (this=0x23c7bc0, status=4)
>     at /home/radim/devel/qgis/src/core/qgstaskmanager.cpp:653
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list