I guess you are correct Krzysztof. Making the 'add_node_to_recolor_wheel' function empty stops Inkscape from crashing. So the problem has to lie in the casting. I have also tried :

RecolorWheelPrivate *priv;
priv = G_TYPE_INSTANCE_GET_PRIVATE (wheel, RECOLOR_TYPE_COLOR_WHEEL,
                                      RecolorWheelPrivate);
// followed by the code (priv->nodes).insert( std::pair<std::string,RecolorWheelNode>(name,node) );

but this again leads to a crash. 

Finally, atleast the brickwall is clear to us. Now all we need is a road roller :)
so the function crashing Inkscape is:

void add_node_to_recolor_wheel (RecolorWheel *wheel, std::string name, RecolorWheelNode node)
{
    RecolorWheelPrivate *priv  = (RecolorWheelPrivate*) (wheel->priv);
    (priv->nodes).insert( std::pair<std::string,RecolorWheelNode>(name,node) );
}



On Wed, Aug 28, 2013 at 10:33 PM, Arshdeep Singh <moduli16@gmail.com> wrote:
These are the two functions:

void add_node_to_recolor_wheel (RecolorWheel *wheel, std::string name, RecolorWheelNode node)
{
    RecolorWheelPrivate *priv  = (RecolorWheelPrivate*) (wheel->priv);
    (priv->nodes).insert( std::pair<std::string,RecolorWheelNode>(name,node) );
}

void remove_node_to_recolor_wheel (RecolorWheel *wheel, std::string name)
{
    RecolorWheelPrivate *priv  = (RecolorWheelPrivate*) wheel->priv;

    std::map<std::string,RecolorWheelNode>::iterator iter;
    iter = priv->nodes.find(name);
    priv->nodes.erase( iter );   
}



On Wed, Aug 28, 2013 at 9:38 PM, Krzysztof Kosiński <tweenk.pl@gmail.com> wrote:
2013/8/28 Arshdeep Singh <moduli16@gmail.com>:
> RecolorWheel* wheel = (RecolorWheel*)
> (((RecolorWheelSelector*)(rsel))->getWheel()) ;

This is a forced cast. Change this to GObject casts, e.g.

RecolorWheel *wheel = RECOLOR_WHEEL(RECOLOR_WHEEL_SELECTOR(rsel)->getWheel());

This way if you made a mistake here, you'll get a runtime warning.

>             add_node_to_recolor_wheel (wheel, obj->getId() , temp );

The problem might also be inside this function.

Regards, Krzysztof



--
Arshdeep Singh
Third Year, Computer Engineering
Delhi Technological University
Ph: +91-9654115614
https://sites.google.com/site/adsingh1729/home



--
Arshdeep Singh
Third Year, Computer Engineering
Delhi Technological University
Ph: +91-9654115614
https://sites.google.com/site/adsingh1729/home