Opened 14 years ago

Closed 13 years ago

#2714 closed bug (fixed)

Crash when resizing map window with Qt 4.6

Reported by: mhugent Owned by: nobody
Priority: critical: causes crash or data corruption Milestone: Version 1.7.0
Component: GUI Version: Trunk
Keywords: Cc:
Must Fix for Release: No Platform: All
Platform Version: Awaiting user input: no

Description

Load a large vector file. Resize the main windows several time (or add the attribute table docked). Qgis crashes with Qt 4.6. With 4.5, there was no crash. Maybe this is because of concurrent vector access?

Attachments (4)

qgis_canvas_resize_point_bt (40.3 KB ) - added by marisn 13 years ago.
Resizing canvas with single point layer and render cache "on"
qgis_canvas_resize_line_bt (33.7 KB ) - added by marisn 13 years ago.
Resizing canvas with single line layer and render cache "on"
qgis_1_6_branch_resize_crash1.txt (2.9 KB ) - added by neteler 13 years ago.
crash log
qgis_1_6_branch_resize_crash2.txt (2.9 KB ) - added by neteler 13 years ago.
crash log

Download all attachments as: .zip

Change History (26)

comment:1 by wonder, 14 years ago

It seems it's caused by the processEvents() calls in QgsVectorLayer - the crash happens in Qt libraries. If I comment out the processEvents() calls, the segfault is gone.

My GSoC project should handle this once the rendering will be completely done in worker thread(s), but that will be too late for 1.5. So probably we should just disable these calls (they are already disabled on OS X).

comment:2 by mhugent, 14 years ago

Looking forward for a clean solution with the worker thread. For the short term (1.5), maybe it is possible to improve the protection for the render method?

Because disable the calls of processEvents would mean no incremental screen updates and no interruption of the rendering for 1.5? This would make handling of large datasets with QGIS very difficult.

in reply to:  2 comment:3 by jef, 14 years ago

Replying to mhugent:

Because disable the calls of processEvents would mean no incremental screen updates and no interruption of the rendering for 1.5? This would make handling of large datasets with QGIS very difficult.

The WMS provider now has the same problem. It seems to be a bug in the new Qt Animation Framework as the Qt Bug report #6797 looks related.

Following change works around the problem:

Index: src/gui/qgsmapcanvas.cpp
===================================================================
--- src/gui/qgsmapcanvas.cpp	(revision 13491)
+++ src/gui/qgsmapcanvas.cpp	(working copy)
@@ -960,7 +960,11 @@
     updateCanvasItemPositions();
 
     updateScale();
+#if QT_VERSION >= 0x40600
+    QTimer::singleShot( 1, this, SLOT( refresh() ) );	// take rendering outside of resizeEvent()
+#else
     refresh();
+#endif
     emit extentsChanged();
   }
   isAlreadyIn = false;

comment:4 by jef, 14 years ago

I applied the workaround in r13500.

comment:5 by jef, 14 years ago

Must Fix for Release: YesNo

comment:6 by jef, 14 years ago

Priority: critical: causes crash or data corruptionminor: annoyance

workaround fixes the crash.

comment:7 by pcav, 14 years ago

Milestone: Version 1.5.0Version 1.6.0

in reply to:  6 comment:8 by marisn, 14 years ago

Replying to jef:

workaround fixes the crash.

No. It doesn't. Can't get backtrace, as running under GDB frezes whole KDE and core is truncated.

Resizing window with present vector layer still results in segfault. Can be trigerred also by moving around toolbars (cause canvas resize). And this isn't "minor: annoyance"

QGIS trunk 13763
Qt 4.6.3
Gentoo ~AMD64

comment:9 by timlinux, 13 years ago

Priority: minor: annoyancecritical: causes crash or data corruption

by marisn, 13 years ago

Attachment: qgis_canvas_resize_point_bt added

Resizing canvas with single point layer and render cache "on"

by marisn, 13 years ago

Attachment: qgis_canvas_resize_line_bt added

Resizing canvas with single line layer and render cache "on"

comment:10 by marisn, 13 years ago

Issue dissapears when I disable "Use render caching" in Options. Also - to make QGIS crash, one needs to issue multiple redraws - resize layer TOC or window and not simply minimize/maximize it. Seems to be some race condition as next redraw has to start before previous is complete.

QGIS trunk 14908
Gentoo ~AMD64
x11-libs/qt-core-4.7.1-r1:4
x11-libs/qt-dbus-4.7.1:4
x11-libs/qt-gui-4.7.1-r1:4
x11-libs/qt-multimedia-4.7.1:4
x11-libs/qt-opengl-4.7.1:4
x11-libs/qt-qt3support-4.7.1:4
x11-libs/qt-script-4.7.1-r1:4
x11-libs/qt-sql-4.7.1:4
x11-libs/qt-svg-4.7.1:4
x11-libs/qt-test-4.7.1:4
x11-libs/qt-webkit-4.7.1-r1:4
x11-libs/qt-xmlpatterns-4.7.1:4
x11-libs/qtscriptgenerator-0.1.0:0

comment:11 by jef, 13 years ago

see also #2884. r15505 might fix this.

in reply to:  11 comment:12 by jef, 13 years ago

Replying to jef:

see also #2884. r15505 might fix this.

r15050 that is.

comment:13 by jef, 13 years ago

see also #2339

comment:14 by adbosco, 13 years ago

This looks a lot like the (possible) race condition that causes the crashes on changing symbology, reported on #3380, #3381 and #3391.

in reply to:  11 ; comment:15 by lutra, 13 years ago

Replying to jef:

see also #2884. r15505 might fix this.

The crash when resizing the overview windows is indeed fixed. Unfortunately it seems that there is a secondary problem (let me know if you want me to open a new ticket): resizing the overview windows is very slow, with both the "cache rendering" enabled or disabled. Just tested it with a couple of polygon/line layers (shapes, wfs).

in reply to:  15 comment:16 by lutra, 13 years ago

it doesn't seems to resize vertically at all.

The crash when resizing the overview windows is indeed fixed. Unfortunately it seems that there is a secondary problem (let me know if you want me to open a new ticket): resizing the overview windows is very slow, with both the "cache rendering" enabled or disabled. Just tested it with a couple of polygon/line layers (shapes, wfs).

comment:17 by jef, 13 years ago

Resolution: fixed
Status: newclosed

should be fixed in r15050.

by neteler, 13 years ago

crash log

by neteler, 13 years ago

crash log

comment:18 by neteler, 13 years ago

Resolution: fixed
Status: closedreopened

Having loaded two vector maps (LAEA, no reprojection on the fly), resizing the window leads to a crash. Logs of two events attached.

System: Linux north 2.6.33.7-desktop-2mnb #1 SMP Mon Sep 20 18:19:20 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux

Qt 4.6.2

If it was fixed on trunk, please backport to 1.6 since it is a major showstopper.

comment:19 by pcav, 13 years ago

I just got a crash resizing a window on r15260, so I'm not so sure it is fully fixed in trunk.

comment:20 by pcav, 13 years ago

See also #2942, possibly duplicated

comment:21 by aghisla, 13 years ago

I can reproduce this bug with a huge shapefile - 37k points - and resize the main window from a corner twice. It happens anytime, disregarding render caching setting.

r15724, Qt 4.7.1

comment:22 by mhugent, 13 years ago

Resolution: fixed
Status: reopenedclosed

Hopefully fixed with r15771 (tested with Qt 4.7 and 4.6.2 on Linux).

Note: See TracTickets for help on using tickets.