[Qgis-developer] should legends be shown for invisible layers ?
strk at keybit.net
Mon Dec 15 13:02:50 PST 2014
On Mon, Dec 15, 2014 at 04:21:46PM +0100, Sandro Santilli wrote:
> On Mon, Dec 15, 2014 at 02:24:27PM +0100, Sandro Santilli wrote:
> > On Mon, Dec 15, 2014 at 06:56:39PM +0700, Martin Dobias wrote:
> > > I'm not sure I like the fact that QgsMapSettings would be passed when
> > > legend nodes are created. I guess with invalidateMapBasedData() having
> > > QgsMapSettings pointer that would not be necessary.
> > If we want ::data() to lazily load the legend, there will be a need to
> > store the "last used map settings" anyway. Unless we leave all the caching
> > to the single layer (rather than to each of the layertree nodes).
> I'm testing this lazy load of legend from QgsWMSLegendNode::data but
> experiencing memory errors due to what looks like fragility of the
> QgsWmsProvider::getLegendGraphic method. In particular, calling that
> method again while the old one did not get to a complete response
> from server seems to put it in an unusable state, eventually getting
> to segfaults. Does it make sense ?
To confirm the problem being in QgsWmsProvider::getLegendGraphic, this
implementation in ::data() removes any segfault:
QImage nImg( 256, 256, QImage::Format_ARGB32 );
painter.drawText(QPointF(0,0), QString("provider is %1").arg((long)(layer->dataProvider())));
mImage = nImg;
mImage = layer->dataProvider()->getLegendGraphic(0, false, extent);
Ginetto, you're the author of that function, can you think of a reason
why a call to that method can trigger a segfault originating from some qt
event ? See the backtrace here: http://strk.keybit.net/tmp/BT
() ASCII ribbon campaign -- Keep it simple !
More information about the Qgis-developer