<div dir="ltr">Hi,<div><br></div><div>I have Canvas in Silica Dialog page but app crashes when leaving dialog page both with accept or cancel swipe. It does not crash always just quite often.</div><div><br></div><div>the code:</div>
<div><pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">Canvas</span><span style="color:rgb(192,192,192)"> </span>{</font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,0)">id</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">imageCanvas</span></font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,0)">visible</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">isImageUrl</span></font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,0)">width</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">imgLoader</span>.sourceSize.width</font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,0)">height</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">imgLoader</span>.sourceSize.height</font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,0)">renderStrategy</span>:<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">Canvas</span>.Immediate</font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,0)">onPaint</span>:<span style="color:rgb(192,192,192)"> </span>{</font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">                </span><span style="color:rgb(128,128,0)">var</span><span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(41,133,199)">ctx</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">getContext</span>(<span style="color:rgb(0,128,0)">"2d"</span>)</font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">                </span><span style="font-style:italic;color:rgb(41,133,199)">ctx</span>.drawImage(<span style="font-style:italic;color:rgb(0,0,0)">imgLoader</span>,<span style="color:rgb(192,192,192)"> </span>0,<span style="color:rgb(192,192,192)"> </span>0)</font></pre>
<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace">            }</font></pre>
<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">        </span>}<br></font></pre>
<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">Image</span><span style="color:rgb(192,192,192)"> </span>{</font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,0)">id</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">imgLoader</span></font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,0)">visible</span>:<span style="color:rgb(192,192,192)"> false</span></font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,0)">source</span>:<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">isImageUrl</span><span style="color:rgb(192,192,192)"> </span>?<span style="color:rgb(192,192,192)"> </span><span style="font-style:italic;color:rgb(0,0,0)">url</span><span style="color:rgb(192,192,192)"> </span>:<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">""</span></font></pre>

<pre style="margin-top:0px;margin-bottom:0px"><font face="courier new, monospace"><span style="color:rgb(192,192,192)">        </span>}</font></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre></div><div>The idea is to save image to the gallery in <span style="color:rgb(128,0,0)">onAccepted</span> if user has selected that option as Canvas has save method which can be used to save image to a file.</div>
<div><br></div><div>And it works fine, but causing app to crash sometimes when leaving Dialog page with cancel swipe. SDK outputs a long crash dump.</div><div><br></div><div>-Samuli</div></div>