bolksoft / heekscad

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

Crash when clicking on model. #334

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm getting a crashing when clicking on a model with the latest code from the 
repository (2011/03/23).  This is my own build in Ubuntu 10.10 on a 64-bit 
machine.

Here is the stack dump from gdb run postmortem on the core file.

Core was generated by `heekscad'.
Program terminated with signal 11, Segmentation fault.
#0  0x000000000058c36d in MarkedList::ObjectsInWindow (this=0x29165f0, 
window=..., marked_object=0x7fff1f8f5f20, single_picking=true) at 
/opt/HeeksCAD/HeeksCAD/src/MarkedList.cpp:170
170                         if((object->GetType() == GripperType) || ((object->GetMarkingMask() & 
m_filter) && (object->GetMarkingMask() != 0))){
(gdb) bt
#0  0x000000000058c36d in MarkedList::ObjectsInWindow (this=0x29165f0, 
window=..., marked_object=0x7fff1f8f5f20, single_picking=true) at 
/opt/HeeksCAD/HeeksCAD/src/MarkedList.cpp:170
#1  0x000000000058c832 in MarkedList::FindMarkedObject (this=0x29165f0, 
point=..., marked_object=0x7fff1f8f5f20) at 
/opt/HeeksCAD/HeeksCAD/src/MarkedList.cpp:230
#2  0x00000000005a6d89 in CViewport::FindMarkedObject (this=0x2b03280, 
point=..., marked_object=0x7fff1f8f5f20) at 
/opt/HeeksCAD/HeeksCAD/src/GraphicsCanvas.cpp:656
#3  0x0000000000657704 in HeeksCADapp::FindMarkedObject (this=0x2915ce0, 
point=..., marked_object=0x7fff1f8f5f20) at 
/opt/HeeksCAD/HeeksCAD/src/HeeksCAD.cpp:629
#4  0x000000000079924a in CSelectMode::OnMouse (this=0x2916470, event=...) at 
/opt/HeeksCAD/HeeksCAD/src/SelectMode.cpp:124
#5  0x00000000005a5cc2 in CViewport::ViewportOnMouse (this=0x2b03280, 
event=...) at /opt/HeeksCAD/HeeksCAD/src/GraphicsCanvas.cpp:337
#6  0x00000000005a5daf in CGraphicsCanvas::OnMouse (this=0x2b03000, event=...) 
at /opt/HeeksCAD/HeeksCAD/src/GraphicsCanvas.cpp:355
#7  0x00007f4555bf3310 in 
wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, 
wxEvtHandler*, wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0
#8  0x00007f4555bf42d4 in wxEventHashTable::HandleEvent(wxEvent&, 
wxEvtHandler*) () from /usr/lib/libwx_baseu-2.8.so.0
#9  0x00007f4555bf43b7 in wxEvtHandler::ProcessEvent(wxEvent&) () from 
/usr/lib/libwx_baseu-2.8.so.0
#10 0x00007f45556ed652 in ?? () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#11 0x00007f454a1469d8 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#12 0x00007f4548884a6e in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#13 0x00007f454889ade7 in ?? () from /usr/lib/libgobject-2.0.so.0
#14 0x00007f454889c0eb in g_signal_emit_valist () from 
/usr/lib/libgobject-2.0.so.0
#15 0x00007f454889c863 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#16 0x00007f454a25f6df in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#17 0x00007f454a13ee73 in gtk_propagate_event () from 
/usr/lib/libgtk-x11-2.0.so.0
#18 0x00007f454a13ff4b in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#19 0x00007f4549db974c in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#20 0x00007f4547fc3342 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#21 0x00007f4547fc72a8 in ?? () from /lib/libglib-2.0.so.0
#22 0x00007f4547fc77b5 in g_main_loop_run () from /lib/libglib-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#23 0x00007f454a1403e7 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#24 0x00007f45556da578 in wxEventLoop::Run() () from 
/usr/lib/libwx_gtk2u_core-2.8.so.0
#25 0x00007f455575fb1b in wxAppBase::MainLoop() () from 
/usr/lib/libwx_gtk2u_core-2.8.so.0
#26 0x000000000066a7ed in HeeksCADapp::OnRun (this=0x2915ce0) at 
/opt/HeeksCAD/HeeksCAD/src/HeeksCAD.cpp:3315
#27 0x00007f4555b99695 in wxEntry(int&, wchar_t**) () from 
/usr/lib/libwx_baseu-2.8.so.0
#28 0x000000000064f11d in main (argc=1, argv=0x7fff1f8f6ef8) at 
/opt/HeeksCAD/HeeksCAD/src/HeeksCAD.cpp:74

Original issue reported on code.google.com by jcoffl...@gmail.com on 23 Mar 2011 at 11:54

GoogleCodeExporter commented 8 years ago
Looks like a null pointer dereference to me.

Original comment by jcoffl...@gmail.com on 23 Mar 2011 at 11:55

GoogleCodeExporter commented 8 years ago
This is a problem with 64bit computers. ( I don't have a 64 bit computer ).
The problem is that I am using a cast memory point of my HeeksObj objects, as a 
"name" for the OpenGL picking.
See this line in HeeksCAD/src/MarkedList.cpp:
HeeksObj *object = (HeeksObj *)(data[pos]);

The problem is that the "name" data, that it is casting back from, is probably 
only 32-bit, so we are getting a bad memory pointer.

or maybe it's a problem that I am casting using "unsigned long" and that is 
messing up the 64-bit pointer.
( see this code in src/HeeksCAD.cpp :
if(select)glPushName((unsigned long)object)

Original comment by danhe...@gmail.com on 23 Mar 2011 at 12:04

GoogleCodeExporter commented 8 years ago
Thanks looking in to this.  Great looking software by the way.

I'm a software developer as well.  I noticed on one of your Web pages that 
people can request commit access to the repository.  To establish some 
credentials, I'm currently the main programmer for the Folding@home project and 
am proprietor of Cauldron Development LLC.

Now that you've given me some pointers I'll see if I can fix the problem myself.

It would be great to get some 64-bit Ubuntu packages working well.  I noticed 
there is an empty heekscad PPA on Ubuntu's site.  Any idea who is responsible 
for this?

Original comment by jcoffl...@gmail.com on 23 Mar 2011 at 9:46

GoogleCodeExporter commented 8 years ago
According to the document below glPushName() takes a GLuint which is a 32-bit 
number I believe, which confirms your assessment.

  http://pyopengl.sourceforge.net/documentation/manual/glPushName.3G.html

I'll see if can figure something out.

Original comment by jcoffl...@gmail.com on 24 Mar 2011 at 4:06

GoogleCodeExporter commented 8 years ago
OK, I've come up with a fix.  I created a small indexing class, have made 
HeeksObjs get an index when they need one and release it when they are 
deallocated.  This fixed the crashes I was experiencing on the 64-bit system 
when clicking objects.

Attached patches for HeeksCAD and HeeksCNC are against r1434 and r1312 
respectively.  The HeeksCNC patch is very small but important.

Original comment by jcoffl...@gmail.com on 24 Mar 2011 at 8:16

Attachments:

GoogleCodeExporter commented 8 years ago
Slight change the previous attachment.

Original comment by jcoffl...@gmail.com on 24 Mar 2011 at 8:22

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks a lot Joseph. I have tried this in my 32-bit Windows build. It seems to 
still work OK. I have committed your changes to HeeksCAD and HeeksCNC.
I have added you as a committer to HeeksCAD and HeeksCNC projects. I am 
guessing you are jcoffland@gmail.com ( this website is hiding your full email 
address ).
You should now be able to committ changes. You will need to change your SVN 
path from http to https.
Thanks again.
Dan Heeks.

Original comment by danhe...@gmail.com on 24 Mar 2011 at 8:51

GoogleCodeExporter commented 8 years ago
Awesome.  Thanks!

Original comment by jcoffl...@gmail.com on 24 Mar 2011 at 9:10