Crash while testing brush settings

Francisco Fernandes francisco.fernandes.j at gmail.com
Mon Sep 10 22:19:57 UTC 2012


Hi Lukast!

The problem it's like Boud said: I'm using a weak shared pointer to hold a
KisImage.
I tried  your solution, but the crash persisted. Problem is the way
I hold the particles. I add a "Particle" KisAnnotation to the KisImage.
Previously, I added these annotations at each call of paintAt(), but it was
making the brush slow.
So I added in the end of the process, in the destructor :


KisSandPaintOp::~KisSandPaintOp()
{
    //Serialize the particles added by the pouring and hold them in an
annotation
    QList<Particle *> parts;

    //Retrieve the currently added particles
    getGrains(parts);

    if(parts.size() > 0){

        QByteArray * b_array = new QByteArray();
        QDataStream stream(b_array, QIODevice::ReadWrite);
        for(int i = 0; i < parts.size(); i++){
            stream << *parts.at(i);
        }

        /*
        * Add particles to the "Particle" annotation
        */

         //m_image is a KisImageWSP
        if(m_image){
            m_image->addAnnotation(KisAnnotationSP(new KisAnnotation(
"Particle",
                                                                    "Set of
grains created by the paintop",

*b_array)
                                                )
                                    );
        }
    }

    delete m_sandBrush;
}

I tried to hold directly with a KisAnnotation instead of a KisImageWSP, but
I can't figure how to
add the annotation to the image without such reference. There's another way
to do that without
a KisImage pointer in the class?

2012/9/3 Lukast dev <lukast.dev at gmail.com>

> > Actually it counts as a KisImage. Since this is the case, what can I do
> to
> > make the brush work in the settings widget?
>
> I solved this problem in one of my brush engines like this:
>
> I needed to know the dimension of the image (widht/height) from KisImage.
> So I decided that if there is KisImage present, I will use KisImage
> dimension,
> otherwise I use some dummy dimension like 1000x1000 or something like that
> :)
>
> Cheers
> LukasT
> _______________________________________________
> kimageshop mailing list
> kimageshop at kde.org
> https://mail.kde.org/mailman/listinfo/kimageshop
>



-- 
____________________________________________________________________________
Francisco Fernandes (AKA: Chicao)
..........................................................................................
Blog: http://pedepinico.blogspot.com
Identi.ca: http://identi.ca/chicao
Twitter: http://twitter.com/__chicao
..........................................................................................
"Quem de boa vontade carrega o difícil, também carrega o menos difícil..."
Lao Tsé - Tao Te Ching
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kimageshop/attachments/20120910/bd3044d8/attachment.html>


More information about the kimageshop mailing list