[Qgis-developer] Crash when loading layers in memory

Martin Dobias wonder.sk at gmail.com
Tue Jan 26 06:50:43 EST 2010


On Tue, Jan 26, 2010 at 11:36 AM, A. Golubev <golubev at nordcomp.ru> wrote:
> Hi, devs!
> I`m trying to load vector layers into memory for better performance, but at
> some point application crashes.
> Here is the simple example:
> [...]
>
> If vl->copySymbologySettings( *newLayer ) commented, then loading project
> successfull, else - application crashes.
> Any suggestions?

It would be helpful if you provided a backtrace. And what QGIS version is that?

One suggestion: instead of copySymbologySettings() try using something like:
vl->setRenderer( newlayer->renderer()->clone() )
IMHO copySymbologySettings() (and hasCompatibleSymbology()) are legacy
methods and it would be better not to use them as they might be
removed in future.

If you're working with QGIS >= 1.4 then layer might use rendererV2()
and renderer() is NULL. Check isUsingRendererV2() to find out which
one is valid.

Martin


More information about the Qgis-developer mailing list