Mon, 12/23/2024 - 13:46
Forums:
Whilst processing selection from mouse-clicks, I've notice that if I click the same object twice (in my case a Point): aka I select something which is already selected, SelectPoint() throws a SIGABORT and dies.
Alas, I don't have the debug OCCT build running. Before I dive into this further, has anyone seen this before or can take a guess why?
I've attached a picture showing the backtrace.
Running 7.8.2
Mat
Attachments:
Mon, 12/23/2024 - 16:57
Hello. Could you please attach your small sample as a code. It is looke a bug. For sure you can check that object are selected or not as a workaround. But crash should not be exist.
And if possible, create an issue: https://github.com/Open-Cascade-SAS/OCCT/issues/new?assignees=&labels=2....
Best regards, Dmitrii
Fri, 12/27/2024 - 16:36
Thanks Dmitrii,
Before posting as a bug, I rebuilt the OCCT libraries in Debug mode and its led me down some more paths. It seems I'm getting exceptions throw way before I get to this point, they just aren't showing up.
My application uses the mouse input to insert points, then lines between them, to build shapes. I use the mouse-move events to dynamically redraw the line from the previous point, until the user clicks and 'locks it' into place. The big problem I've got is that any line will always start with the same start and end points (because the mouse will always be hovering over it). This causes an exception to be thrown in
which is called from AIS_Line::ComputeSegmentLine()
I can't for the life of my think of a way to get around this at application level: there will always be a possibility of a zero-vector line, because no matter where I start from, its user-controlled (the mouse). I'm wondering if this is still a bug, as a zero-vector line isn't actual an invalid case (just an odd one) - it seems a little overkill to be throwing an exception on.
Appreciate your thoughts?
Mat
Fri, 12/27/2024 - 17:45
One may conclude from
AIS_Line
name that this presentation is defined to display an infinite line (clipped to some segment for viewing purposes). And line cannot be defined between two identical points...While it might be nice if
AIS_Line
would catch this and emit some error or throw exception inAIS_Line::Points()
instead of::Compute()
- that wouldn't make it make much a difference for your use case. Instead, you may useAIS_Shape
for the same purposes.Sun, 12/29/2024 - 13:48
Thanks!
In the end I managed to solve it using several beers. As I'm working in 2D, I just set Z to be 0 at the start point and 1 at the end!