<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.Shkpostityyli17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 2.0cm 70.85pt 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FI" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Mapserver-users may be quiet but not dead. In your case you did not get an answer from there probably because most people which I classify to Mapserver
 users do not know what is mapdraw.c or mapkmlrenderer.cpp. Thank you still for posting to mapserver-users because now we users know that there can be some trouble with rendering to KML and if we experience something similar we can refer to your mail.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">For me it looks like you’ve done good work with debugging and I believe that it will help the developers  to resolve the issue.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-Jukka Rahkonen-<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">yeryry wrote<br>
<br>
<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US">Reposting this here as mapserver-users seems pretty dead...<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">I think I've discovered two causes of crashes...<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US"><br>
First, one with </span>the KML driver...<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
msDrawQueryLayer creates and draws a temporary layer here:<br>
<a href="https://github.com/mapserver/mapserver/blob/bdd421c7e69e2ff16841c12c08ba688b62a9f9a6/mapdraw.c#L1209" target="_blank">https://github.com/mapserver/mapserver/blob/bdd421c7e69e2ff16841c12c08ba688b62a9f9a6/mapdraw.c#L1209</a><br>
The KML renderer sets a reference to the temporary layer here:<br>
<a href="https://github.com/mapserver/mapserver/blob/3e8aa5a4d92c9bad105306ebe5117ed29d2b0e7c/mapkmlrenderer.cpp#L371" target="_blank">https://github.com/mapserver/mapserver/blob/bdd421c7e69e2ff16841c12c08ba688b62a9f9a6/mapkmlrenderer.cpp#L371</a><br>
msDrawQueryLayer later calls msDrawShape here:<br>
<a href="https://github.com/mapserver/mapserver/blob/3e8aa5a4d92c9bad105306ebe5117ed29d2b0e7c/mapdraw.c#L1295" target="_blank">https://github.com/mapserver/mapserver/blob/bdd421c7e69e2ff16841c12c08ba688b62a9f9a6/mapdraw.c#L1299</a><br>
which eventually results in a call to KmlRenderer::renderGlyphs<br>
<a href="https://github.com/mapserver/mapserver/blob/3e8aa5a4d92c9bad105306ebe5117ed29d2b0e7c/mapkmlrenderer.cpp#L693" target="_blank">https://github.com/mapserver/mapserver/blob/bdd421c7e69e2ff16841c12c08ba688b62a9f9a6/mapkmlrenderer.cpp#L693</a><br>
which gets to KmlRenderer::createPlacemarkNode and reuses the reference that was set:<br>
<a href="https://github.com/mapserver/mapserver/blob/3e8aa5a4d92c9bad105306ebe5117ed29d2b0e7c/mapkmlrenderer.cpp#L585" target="_blank">https://github.com/mapserver/mapserver/blob/bdd421c7e69e2ff16841c12c08ba688b62a9f9a6/mapkmlrenderer.cpp#L585</a><br>
even though that temporary layer was freed earlier, leading to the crash.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">And one with WMS:<br>
<br>
It crashes around here:<br>
<a href="https://github.com/mapserver/mapserver/blob/3e8aa5a4d92c9bad105306ebe5117ed29d2b0e7c/mapdraw.c#L106" target="_blank">https://github.com/mapserver/mapserver/blob/bdd421c7e69e2ff16841c12c08ba688b62a9f9a6/mapdraw.c#L106</a><o:p></o:p></p>
</div>
<p class="MsoNormal">Probably due to trying to set NULL->map... That error message should probably be moved before that line.<br>
In my case though, I was trying to serve KML over WMS, so "not having an image" shouldn't really be an error condition? And that non-square-pixels thing also shouldn't be relevant for vector layers; currently the dimensions of the requested WMS "image" have
 a big effect on KML output coordinates, which strikes me as broken, so perhaps that whole function should be avoided for vector output.<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>