[QGIS-Developer] Crash at application termination on Linux

Even Rouault even.rouault at spatialys.com
Sat Jun 2 05:57:10 PDT 2018


Hi,

wondering if I'm the only one in that case, but I get systematic crashes on QGIS exit on Ubuntu 16.04, with master or 2.18 branch
This is super annoying conceptually, and on practice as well since on master, gdb gets automatically attached to the process, which is slow.

When running under Valgrind, this is typically due to things like the following [1], but this is just an extract of
a long list of errors.
There are as many occurences of this as there are static variables using QT data types in QGIS code base.
I experimented changing a few of them, by changing to static pointers instead, and not as static members, and
with explicit cleanup() function to reclaim the memory explicitly from QgsApplication::exitQgis().
This works, but this is super tedious, and I'm wondering if I'm not missing something obvious.

Like if libqgis_core would be deinitialized after libQTCore.

Do other people experiment that issue as well ?

Even

[1]
==459== Invalid read of size 4
==459==    at 0x8117B84: load<int> (qgenericatomic.h:90)
==459==    by 0x8117B84: QBasicAtomicInteger<int>::load() const (qbasicatomic.h:116)
==459==    by 0x8117693: QtPrivate::RefCount::deref() (qrefcount.h:60)
==459==    by 0x8A331AA: QVector<QgsPalLayerSettings::PredefinedPointPosition>::~QVector() (qvector.h:68)
==459==    by 0xC37C369: __cxa_finalize (cxa_finalize.c:56)
==459==    by 0x8111BE2: ??? (in /home/even/qgis/QGIS/build/output/lib/libqgis_core.so.3.1.0)
==459==    by 0x4010DE6: _dl_fini (dl-fini.c:235)
==459==    by 0xC37BFF7: __run_exit_handlers (exit.c:82)
==459==    by 0xC37C044: exit (exit.c:104)
==459==    by 0xC362836: (below main) (libc-start.c:325)
==459==  Address 0x3ce8de50 is 0 bytes inside a block of size 56 free'd
==459==    at 0x4C2ECF0: free (vg_replace_malloc.c:530)
==459==    by 0x55B4EACA: QTypedArrayData<QgsPalLayerSettings::PredefinedPointPosition>::deallocate(QArrayData*) (qarraydata.h:222)
==459==    by 0x55B4E9B4: QVector<QgsPalLayerSettings::PredefinedPointPosition>::freeData(QTypedArrayData<QgsPalLayerSettings::PredefinedPointPosition>*) (qvector.h:492)
==459==    by 0x55B4E81D: QVector<QgsPalLayerSettings::PredefinedPointPosition>::~QVector() (qvector.h:68)
==459==    by 0xC37BFF7: __run_exit_handlers (exit.c:82)
==459==    by 0xC37C044: exit (exit.c:104)
==459==    by 0xC362836: (below main) (libc-start.c:325)
==459==  Block was alloc'd at
==459==    at 0x4C2DBF6: malloc (vg_replace_malloc.c:299)
==459==    by 0xB96DE27: QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.5.1)
==459==    by 0x55B57217: QTypedArrayData<QgsPalLayerSettings::PredefinedPointPosition>::allocate(unsigned long, QFlags<QArrayData::AllocationOption>) (qarraydata.h:216)
==459==    by 0x55D27887: QVector<QgsPalLayerSettings::PredefinedPointPosition>::QVector(std::initializer_list<QgsPalLayerSettings::PredefinedPointPosition>) (qvector.h:476)
==459==    by 0x55D260E3: __static_initialization_and_destruction_0(int, int) (qgspallabeling.cpp:76)
==459==    by 0x55D261A5: _GLOBAL__sub_I_qgspallabeling.cpp (qgspallabeling.cpp:3502)
==459==    by 0x40106B9: call_init.part.0 (dl-init.c:72)
==459==    by 0x40107CA: call_init (dl-init.c:30)
==459==    by 0x40107CA: _dl_init (dl-init.c:120)
==459==    by 0x40158E1: dl_open_worker (dl-open.c:575)
==459==    by 0x4010563: _dl_catch_error (dl-error.c:187)
==459==    by 0x4014DA8: _dl_open (dl-open.c:660)
==459==    by 0x1863AF08: dlopen_doit (dlopen.c:66)
==459== 


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the QGIS-Developer mailing list