Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Strange segmentation fault

Credits go to bamccaig, Edgar Reynaldo, and Elias for helping out!
This thread is locked; no one can reply to it. rss feed Print
Strange segmentation fault
Ariesnl
Member #2,902
November 2002
avatar

Any ideas ?
It sometimes happens, sometimes not...

{"name":"610604","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/a\/1a2ac7fd604298cb0ea906896223d910.png","w":1280,"h":1024,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/a\/1a2ac7fd604298cb0ea906896223d910"}610604

Marked line jumps to this ...

#SelectExpand
1void TMenuItem::ProcessMouseEvent(ALLEGRO_MOUSE_EVENT * mouse_event) 2{ 3 if ((mouse_event->x > m_nX) && 4 (mouse_event->x < m_nX + m_nWidth) && 5 (mouse_event->y > m_nY) && 6 (mouse_event->y < m_nY + m_nHeight)) 7 { 8 m_blHighlight = true; 9 if ((m_pCallBack!=NULL)&&(mouse_event->button == 1)) 10 { 11 m_pCallBack(); 12 } 13 } 14 else 15 { 16 //TODO (Anyone #1#): when clicking a menu item sometimes this generates an annoying segmentation fault 17 m_blHighlight = false; 18 } 19}

And this causes a segmentation fault ???

???

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

Elias
Member #358
May 2000

Where is the ALLEGRO_MOUSE_EVENT allocated?

--
"Either help out or stop whining" - Evert

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

bamccaig
Member #7,536
July 2006
avatar

The address seems close to argv. Could that just be where the globals are allocated? shrug

Is there any threading shenanigans going on?

Ariesnl
Member #2,902
November 2002
avatar

I was deleting and rebuilding the menu at some point..
It might be that an event was fired while the menu was gone.. ( not sure) but I changed it to just clearing and adding new menu items.. and the problem seems to be gone..
I hope it stays that way...

Perhaps one day we will find that the human factor is more complicated than space and time (Jean luc Picard)
Current project: [Star Trek Project ] Join if you want ;-)

Go to: