ahmetsemihparlak / heekscad

Automatically exported from code.google.com/p/heekscad
Other
0 stars 1 forks source link

Crash caused by NULL value in MarkedList #338

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There are several places where HeeksCAD crashes on NULL values in 
MarkedList::m_list.  I fixed one of these and checked in the changes already.  
You can find the stacktrace for another below.  However, I'd like to fix the 
source of the problem if possible.

In MarkedList::GetTools() a NULL value is inserted in the list.  Several other 
places in the code are not prepared for this and crash.  Is the NULL necessary? 
 If so I can find all the places in the code that go through this list and have 
them check for the NULL.  Otherwise, we should remove the NULL insert and avoid 
the problem altogether.

#0  0x00000000005b0a8d in MarkedList::create_move_grips (this=0x137a750) at 
/opt/HeeksCAD/HeeksCAD/src/MarkedList.cpp:54
#1  0x00000000005b0ff6 in MarkedList::create_grippers (this=0x137a750) at 
/opt/HeeksCAD/HeeksCAD/src/MarkedList.cpp:98
#2  0x00000000005b104b in MarkedList::GrippersGLCommands (this=0x137a750, 
select=false, no_color=false) at /opt/HeeksCAD/HeeksCAD/src/MarkedList.cpp:105
#3  0x000000000066af1f in HeeksCADapp::glCommandsAll (this=0x1379ea0, 
view_point=...) at /opt/HeeksCAD/HeeksCAD/src/HeeksCAD.cpp:1800
#4  0x00000000005ac8ad in CViewport::glCommands (this=0x1569280) at 
/opt/HeeksCAD/HeeksCAD/src/GraphicsCanvas.cpp:237
#5  0x00000000005ac938 in CGraphicsCanvas::OnPaint (this=0x1569000) at 
/opt/HeeksCAD/HeeksCAD/src/GraphicsCanvas.cpp:254
#6  0x00007ff6dcb1a310 in 
wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, 
wxEvtHandler*, wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0

Original issue reported on code.google.com by jcoffl...@gmail.com on 1 Apr 2011 at 9:29

GoogleCodeExporter commented 9 years ago
I think adding NULL in GetTools means there should be a separator added to the 
drop down menu.

Original comment by danhe...@gmail.com on 1 Apr 2011 at 9:38

GoogleCodeExporter commented 9 years ago
OK, that makes sense.  Maybe it would be better to create and insert a HeeksObj 
derived separator instead to avoid having to check for NULL everywhere else.

I'll look in to this.

Original comment by jcoffl...@gmail.com on 1 Apr 2011 at 10:54

GoogleCodeExporter commented 9 years ago
I fixed this by adding and using MenuSeparator derived from Tool instead of 
NULL in tool list.

Hopefully I got all the NULL inserts to the tool list but this should fix 
several crashes.

Changes in r1443.

Original comment by jcoffl...@gmail.com on 2 Apr 2011 at 12:02