Hi Marco, You're right, this patch does not work. I don't really know it passed the tests I did here. My environment was pretty messy.
I had a look at it again today and tracked down the warning that appeared before the crashes (QWidget::repaint: Recursive repaint detected). This led me to the code in qgsvectorlayer I changed in the attached patch. It looks to me as if this patch really fixes the problem. Still, I'd be happy if you could review the patch, because I don't know, what side-effects it could cause. I think you know what the code I removed did (The initials MH probably say that you already disabled this for Mac) Regards, Matthias On Fri, 2012-07-27 at 16:19 +0200, Marco Hugentobler wrote: > I still have the crash with the patch (Qt::WA_NativeWindow) on my > machine (Qt 4.8.1). > > Regards, > Marco > > Am 27.07.2012 15:10, schrieb Matthias Kuhn: > > > Hi Marco, > > > > thank you for verifying and advises on how to reproduce. I missed the > > part with "without releasing the mouse" > > > > I have created a patch that resolves the issue here. Can you please > > check the patch and commit it if it works for you as well. > > > > Thank you, > > Matthias > > > > > > On Fri, 2012-07-27 at 13:28 +0200, Marco Hugentobler wrote: > > > Hi Matthias > > > > > > I still have the resize crash with Qt 4.8.1. To reproduce, load a layer > > > with many objects. Go with the mouse to the right corner and resize > > > several times without releasing the mouse. After the mouse release, the > > > crash occures. > > > Note: this problem (and the flicker with the workaround) is X11 only. > > > But still, Linux is the most important platform. > > > Btw, the threading branch would be the clean solution for the issue. But > > > if you have another workaround in the short-term, let me know. > > > > > > Regards, > > > Marco > > > > > > > > > Am 27.07.2012 13:08, schrieb Matthias Kuhn: > > > > Hi all, > > > > > > > > there is this issue report #4011 "Map canvas flickers when content is > > > > dragged" which is actually pretty annoying and doesn't get much > > > > attention. ( http://hub.qgis.org/issues/4011 ) I think the solution > > > > would be pretty simple. Please read on. > > > > > > > > It was introduced by f4d26d6211830a866030a333236dcfbf15e077aa "Fix for > > > > resize crash, ticket #2714". > > > > This bugfix disables backbuffering, what fixes the crash but leads to > > > > the beforementioned flickering. > > > > > > > > The crash seems to be related to Qt versions (probably 4.6 and 4.7 > > > > affected). When I tried to reproduce the crash in 4.8.1 (by reverting > > > > abovementioned patch) I couldn't reproduce the crash. So it is well > > > > possible that this problem has been fixed in Qt upstreams. > > > > > > > > But: I myself never could reproduce this crash (due to the lack of a > > > > system with old Qt libs). So, I would be happy if someone familiar with > > > > this problem could confirm that this is fixed with Qt 4.8. > > > > > > > > Then there are two possibilities (unless you come up with a third one): > > > > > > > > 1. Check for qVersion upon every repaint as suggested by Martin Dobias > > > > and then enable/disable the workaround accordingly. > > > > > > > > 2. Switch the workaround on/off by a pre-compiler constant. This way, > > > > any new distro with Qt>=4.8 could be shipped without the workaround-code > > > > being compiled into the binaries. > > > > > > > > Any comments on this issue are very welcome, as it makes QGIS look a lot > > > > sweeter :) > > > > > > > > Regards > > > > > > > > _______________________________________________ > > > > Qgis-developer mailing list > > > > Qgis-developer@lists.osgeo.org > > > > http://lists.osgeo.org/mailman/listinfo/qgis-developer > > > > > > > > > _______________________________________________ > > Qgis-developer mailing list > > Qgis-developer@lists.osgeo.org > > http://lists.osgeo.org/mailman/listinfo/qgis-developer > > > -- > Dr. Marco Hugentobler > Sourcepole - Linux & Open Source Solutions > Weberstrasse 5, CH-8004 Zürich, Switzerland > marco.hugentob...@sourcepole.ch http://www.sourcepole.ch > Technical Advisor QGIS Project Steering Committee > _______________________________________________ > Qgis-developer mailing list > Qgis-developer@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-developer
>From c1a192665b363d3af3414a0375850eeb2b56fe12 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn <matthias.k...@gmx.ch> Date: Wed, 1 Aug 2012 17:51:52 +0200 Subject: [PATCH] Fix flicker --- src/core/qgsvectorlayer.cpp | 2 ++ src/gui/qgsmapcanvas.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index bb555ec..f8096d0 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -733,6 +733,7 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab break; } +#if 0 // MK: disable this totally as it breaks QT painting engine (can result in recursive repaint) #ifndef Q_WS_MAC //MH: disable this on Mac for now to avoid problems with resizing if ( mUpdateThreshold > 0 && 0 == featureCount % mUpdateThreshold ) { @@ -746,6 +747,7 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab qApp->processEvents(); } #endif //Q_WS_MAC +#endif bool sel = mSelectedFeatureIds.contains( fet.id() ); bool drawMarker = ( mEditable && ( !vertexMarkerOnlyForSelection || sel ) ); diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index 3166e74..62d5586 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -84,6 +84,8 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name ) , mAntiAliasing( false ) { setObjectName( name ); + +#if 0 //disable the update that leads to the resize crash if ( viewport() ) { @@ -91,6 +93,7 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name ) viewport()->setAttribute( Qt::WA_PaintOnScreen, true ); #endif //ANDROID } +#endif mScene = new QGraphicsScene(); setScene( mScene ); -- 1.7.11.2
_______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer