Inkscape::Selection *selection = sp_desktop_selection(desktop); GSList const *items = NULL; RecolorWheel* wheel = (RecolorWheel*) (((RecolorWheelSelector*)(rsel))->getWheel()) ; RecolorWheelNode temp;
g_printf("\nWe are here: RecolorArtworkWidget::selectionModifiedCB() ! ");
if ( selection ) { items = selection->itemList();
for (GSList const *i = items; i != NULL; i = i->next) { SPObject *obj=reinterpret_cast<SPObject *>(i->data); Inkscape::XML::Node* obj_repr = obj->getRepr(); SPCSSAttr* obj_css = sp_repr_css_attr( obj_repr , "style" );
guint32 rgb32 = sp_svg_read_color( sp_repr_css_property( obj_css, "fill", "#ababab") , 0xF0F8FF ); SPColor color = SPColor (rgb32);
float rgb[3] , hsv[3]; sp_color_get_rgb_floatv (&color, rgb); sp_color_rgb_to_hsv_floatv (hsv , temp._color[0] , temp._color[1] , temp._color[2] );
add_node_to_recolor_wheel (wheel, obj->getId() , temp );
}
}
Do you anything done in this snippet above is wrong ? Because commenting this out leads to no crashes at all. The moment this is included, everything goes to hell.
On Wed, Aug 28, 2013 at 9:25 PM, Krzysztof Kosiński <tweenk.pl@...400...>wrote:
2013/8/28 Arshdeep Singh <moduli16@...400...>:
Hi, I think the problem lies in the fact that performUpdate() is called many times when we are dragging the nodes on the wheel. That is why, the computationally intensive snippet that I posted a few mails ago in this thread is causing a crash ? Can that be a reason ? If you take a look at
the
snippet, you'll understand what I mean.
No, doing a lot of computations never leads to a crash.
And I really going by Krzysztof's reply, the placement new should not
cause
a crash the way I have used it in my code. Correct ?
Yes, the placement new you added is correct and your crash is caused by something else. The "use after free" messages you are getting indicate that your code is doing something wrong with pointers and accessing unallocated regions of memory.
Regards, Krzysztof