<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:x="urn:schemas-microsoft-com:office:excel" 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=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
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;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.keywordflow
        {mso-style-name:keywordflow;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:3.0cm 2.0cm 3.0cm 2.0cm;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1745300162;
        mso-list-type:hybrid;
        mso-list-template-ids:476882990 67502095 67502105 67502107 67502095 67502105 67502107 67502095 67502105 67502107;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></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="DA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I was trying to use python to add 3 identical points to a QgsRubberBand using .addPoint(point) and was wondering why I got a core dump when I was trying to move the third point to a new position. Looking into the code
 I found the following (line 172 in qgsrubberband.cpp):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">  <span class="keywordflow">
if</span> ( mPoints.</span><span style="font-family:"Courier New""><a href="http://doc.qt.io/qt-4.8/qlist.html#at"><span lang="EN-US">at</span></a></span><span lang="EN-US" style="font-family:"Courier New"">( geometryIndex ).size() == 2 &&<o:p></o:p></span></p>
<p class="MsoNormal"><a name="l00173"></a><span lang="EN-US" style="font-family:"Courier New"">       mPoints.</span><span style="font-family:"Courier New""><a href="http://doc.qt.io/qt-4.8/qlist.html#at"><span lang="EN-US">at</span></a></span><span lang="EN-US" style="font-family:"Courier New"">(
 geometryIndex ).at( 0 ) == mPoints.</span><span style="font-family:"Courier New""><a href="http://doc.qt.io/qt-4.8/qlist.html#at"><span lang="EN-US">at</span></a></span><span lang="EN-US" style="font-family:"Courier New"">( geometryIndex ).at( 1 ) )<o:p></o:p></span></p>
<p class="MsoNormal"><a name="l00174"></a><span lang="EN-US" style="font-family:"Courier New"">  {<o:p></o:p></span></p>
<p class="MsoNormal"><a name="l00175"></a><span lang="EN-US" style="font-family:"Courier New"">       mPoints[geometryIndex].</span><span style="font-family:"Courier New""><a href="http://doc.qt.io/qt-4.8/qlist.html#last"><span lang="EN-US">last</span></a></span><span lang="EN-US" style="font-family:"Courier New"">()
 = p;<o:p></o:p></span></p>
<p class="MsoNormal"><a name="l00176"></a><span lang="EN-US" style="font-family:"Courier New"">  }<o:p></o:p></span></p>
<p class="MsoNormal"><a name="l00177"></a><span lang="EN-US" style="font-family:"Courier New""> 
<span class="keywordflow">else</span><o:p></o:p></span></p>
<p class="MsoNormal"><a name="l00178"></a><span lang="EN-US" style="font-family:"Courier New"">  {<o:p></o:p></span></p>
<p class="MsoNormal"><a name="l00179"></a><span lang="EN-US" style="font-family:"Courier New"">     
</span><span style="font-family:"Courier New"">mPoints[geometryIndex] << p;<o:p></o:p></span></p>
<p class="MsoNormal"><a name="l00180"></a><span style="font-family:"Courier New"">  }</span><span lang="EN-US" style="font-family:"Courier New";color:#1F497D;mso-fareast-language:DA"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I was wondering why this special check is made?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I wanted to just add 3 points to the rubber band to initialize it with the points that I needed. It was easy to just copy the same “addPoint” line 2 times, but a workaround is simply adding 3 different dummy points and
 then later move them to where I want them. The .movePoint don’t check for the above and doesn’t care if the three points are identical.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">My reason for asking is that this is not stated in the API [1] and a core dump is pretty difficult to debug if you’re writing python plugins.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Regards, Casper<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if !supportLists]><span lang="EN-US"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">      
</span></span></span><![endif]><span lang="EN-US">https://qgis.org/api/classQgsRubberBand.html#a146d5efca562e8c12a02be5662c111d7<o:p></o:p></span></p>
</div>
</body>
</html>