26 Jul
2013
26 Jul
'13
4:35 p.m.
2013/7/26 Arshdeep Singh <moduli16@...400...>:
Hi, I need to get the number of selected objects on the canvas. I was using the following code:
GSList const *items = selection->itemList(); int selObj = g_slist_length (const_cast<GSList*>(items));
the const_cast was required because:
guint g_slist_length (GSList *list);
If I comment out the g_slist_length command, there is no runtime error. And Inkscape run's perfect. In this scenario, what can I do to get the length of the GSList ?
The g_slist_length() and the const_cast call is correct. The problem must be in surrounding code. In particular, the selection pointer might be invalid. Please provide some more context.
Regards, Krzysztof