Hi Lukast!<br><br>The problem it's like Boud said: I'm using a weak shared pointer to hold a KisImage.<br>I tried your solution, but the crash persisted. Problem is the way <br>I hold the particles. I add a "Particle" KisAnnotation to the KisImage.<br>
Previously, I added these annotations at each call of paintAt(), but it was making the brush slow. <br>So I added in the end of the process, in the destructor :<br><br><br>KisSandPaintOp::~KisSandPaintOp()<br>{<br> //Serialize the particles added by the pouring and hold them in an annotation<br>
QList<Particle *> parts;<br> <br> //Retrieve the currently added particles<br> getGrains(parts);<br><br> if(parts.size() > 0){<br><br> QByteArray * b_array = new QByteArray();<br> QDataStream stream(b_array, QIODevice::ReadWrite);<br>
for(int i = 0; i < parts.size(); i++){<br> stream << *<a href="http://parts.at">parts.at</a>(i);<br> }<br><br> /*<br> * Add particles to the "Particle" annotation<br>
*/<br><br> //m_image is a KisImageWSP<br> if(m_image){<br> m_image->addAnnotation(KisAnnotationSP(new KisAnnotation( "Particle",<br> "Set of grains created by the paintop",<br>
*b_array)<br> )<br> );<br> }<br> }<br><br> delete m_sandBrush;<br>
}<br><br>I tried to hold directly with a KisAnnotation instead of a KisImageWSP, but I can't figure how to<br>add the annotation to the image without such reference. There's another way to do that without <br>a KisImage pointer in the class?<br>
<br><div class="gmail_quote">2012/9/3 Lukast dev <span dir="ltr"><<a href="mailto:lukast.dev@gmail.com" target="_blank">lukast.dev@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> Actually it counts as a KisImage. Since this is the case, what can I do to<br>
> make the brush work in the settings widget?<br>
<br>
</div>I solved this problem in one of my brush engines like this:<br>
<br>
I needed to know the dimension of the image (widht/height) from KisImage.<br>
So I decided that if there is KisImage present, I will use KisImage dimension,<br>
otherwise I use some dummy dimension like 1000x1000 or something like that :)<br>
<br>
Cheers<br>
<span class="HOEnZb"><font color="#888888">LukasT<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
kimageshop mailing list<br>
<a href="mailto:kimageshop@kde.org">kimageshop@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kimageshop" target="_blank">https://mail.kde.org/mailman/listinfo/kimageshop</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>____________________________________________________________________________<br>Francisco Fernandes (AKA: Chicao)<br>..........................................................................................<br>
Blog: <a href="http://pedepinico.blogspot.com" target="_blank">http://pedepinico.blogspot.com</a><br>Identi.ca: <a href="http://identi.ca/chicao" target="_blank">http://identi.ca/chicao</a><br>Twitter: <a href="http://twitter.com/__chicao" target="_blank">http://twitter.com/__chicao</a><br>
..........................................................................................<br>"Quem de boa vontade carrega o difícil, também carrega o menos difícil..." Lao Tsé - Tao Te Ching<br>