Author Topic: Crash when open project  (Read 5587 times)

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Crash when open project
« on: July 01, 2005, 03:47:23 pm »
When I try to open a project (I want to open codeblock-unix.cbp) codeblocks crashes. when looking with the debugger (although I don't have no idea how it works  :roll: ) I see a lots of new threads, and then the following message:
Code
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 3290)]
0x4023dea7 in wxGenericTreeCtrl::Collapse ()
   from /usr/local/lib/libwx_gtk2-2.4.so

I want to solve this (probably little) bug, but I don't know how to start. please give some hints...

ps.
I use the cvs version, and want to open the same version of codeblocks. as you can see I use wx-2.4.2 (with patch :P) I am using VectorLinux SOHO 5.
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Crash when open project
« Reply #1 on: July 01, 2005, 06:03:47 pm »
Mispunt: What's the backtrace output?

Anyway this tree control business is driving me nuts. I'm *almost sure* there's a null pointer in here somewhere and that's why the tree looks invisible. But how? when? why? :(

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Crash when open project
« Reply #2 on: July 01, 2005, 06:12:08 pm »
I hope I have the right trace (in gdb after the crash I called backtrace, right?)
Code
#0  0x4023dea7 in wxGenericTreeCtrl::Collapse () from /usr/local/lib/libwx_gtk2-2.4.so
#1  0x40593e20 in ?? ()
#2  0x082e19d8 in ?? ()
#3  0xbfffe268 in ?? ()
#4  0x082f9e58 in ?? ()
#5  0x404b0054 in ?? () from /usr/local/lib/libwx_gtk2-2.4.so
#6  0x404cf248 in vtable for wxObject () from /usr/local/lib/libwx_gtk2-2.4.so
#7  0x404b0054 in ?? () from /usr/local/lib/libwx_gtk2-2.4.so
#8  0xbfffe288 in ?? ()
#9  0x41246cf0 in ClassBrowser::Update () from /home/mispunt/bin/codeblocks/share/CodeBlocks/plugins/libcodecompletion.so
#10 0x41246cf0 in ClassBrowser::Update () from /home/mispunt/bin/codeblocks/share/CodeBlocks/plugins/libcodecompletion.so
#11 0x41246c48 in ClassBrowser::SetParser () from /home/mispunt/bin/codeblocks/share/CodeBlocks/plugins/libcodecompletion.so
#12 0x4124cd7c in NativeParser::SetClassBrowserProject () from /home/mispunt/bin/codeblocks/share/CodeBlocks/plugins/libcodecompletion.so
#13 0x4124a53d in CodeCompletion::OnProjectActivated () from /home/mispunt/bin/codeblocks/share/CodeBlocks/plugins/libcodecompletion.so
#14 0x402e2dc6 in wxEvtHandler::SearchEventTable () from /usr/local/lib/libwx_gtk2-2.4.so
#15 0x402e2bcc in wxEvtHandler::ProcessEvent () from /usr/local/lib/libwx_gtk2-2.4.so
#16 0x402e2c04 in wxEvtHandler::ProcessEvent () from /usr/local/lib/libwx_gtk2-2.4.so
#17 0x402e2c04 in wxEvtHandler::ProcessEvent () from /usr/local/lib/libwx_gtk2-2.4.so
#18 0x402e2c04 in wxEvtHandler::ProcessEvent () from /usr/local/lib/libwx_gtk2-2.4.so
#19 0x402e2c04 in wxEvtHandler::ProcessEvent () from /usr/local/lib/libwx_gtk2-2.4.so
#20 0x402e2c04 in wxEvtHandler::ProcessEvent () from /usr/local/lib/libwx_gtk2-2.4.so
#21 0x405a7932 in ?? ()
#22 0x082d1518 in ?? ()
#23 0xbfffe4b0 in ?? ()
#24 0x00000000 in ?? ()
#25 0x405631ed in ?? ()
#26 0xbfffe500 in ?? ()
#27 0x00000010 in ?? ()
#28 0xbfffe488 in ?? ()
#29 0x082d1518 in ?? ()
#30 0x00000007 in ?? ()
#31 0x01225290 in ?? ()
#32 0xbfffe518 in ?? ()
#33 0x405b31a5 in ?? ()
#34 0x08225290 in ?? ()
#35 0xbfffe4b0 in ?? ()
#36 0x00000001 in ?? ()
#37 0x402d8080 in wxBaseArrayPtrVoid::Grow () from /usr/local/lib/libwx_gtk2-2.4.so
Previous frame inner to this frame (corrupt stack?)
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Crash when open project
« Reply #3 on: July 01, 2005, 06:25:22 pm »
Okay, thanks for the info!

The "?? ()"'s belong to the parserthreads trying to parse the project. The reason for the multiple ??()'s in the same backtrace are  because the events get called recursively. This is normal (altho "not correct" and IMO it should be changed, yes I know, I'm a purist, grrrr).

Anyway, I assume that the currently active tab is the class browser, right?

The key point here is ClassBrowser::Update(). Something inside that method is allowing null references (hint for debugging: The topmost recognizeable function is the one causing the trouble). And due to the recursive event handling problem^H^H^H^H^H^H^H issue, it's possible that Update() doesn't check for null pointers somewhere. This needs more investigation, and possibly, a couple of sanity_check()'s around. Still I wonder why this only happens with wx2.6... maybe a new event? (ponders)

Anyway try disabling the codecompletion plugin and see what other crashes you can backtrace.

Thanks for your help! :)

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Crash when open project
« Reply #4 on: July 01, 2005, 06:41:05 pm »
Thanks for the explanation rick :)

Quote from: rickg22
Anyway, I assume that the currently active tab is the class browser, right?

if the name of the class browser is "Project", then I am in the class browser, else I am not.

Quote from: rickg22
Anyway try disabling the codecompletion
That worked :)

Quote from: rickg22
Thanks for your help! :)
Thanks for your help! :lol:
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Crash when open project
« Reply #5 on: July 01, 2005, 06:49:11 pm »
OK here's more info.
Code

void ClassBrowser::Update()
{
if (m_pParser)
{
wxArrayString treeState;
::SaveTreeState(m_Tree, m_pParser->GetRootNode(), treeState);
m_pParser->BuildTree(*m_Tree);
::RestoreTreeState(m_Tree, m_pParser->GetRootNode(), treeState);
}
else
m_Tree->DeleteAllItems();
}


Try adding debugging "breakpoints" in each relevant line, like wxmessageboxes combined with printf's to print the values of pointers.

Also, I have a hunch. Might help, might not.

Code

ClassBrowser::ClassBrowser(wxNotebook* parent, NativeParser* np)
    : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxCLIP_CHILDREN),
    m_Parent(parent),
    m_NativeParser(np),
m_pParser(0L)


Try adding a m_Tree(0L) before m_pParser(0L). I've had problems with uninitialized members before, even if they're initialized inside the constructor. I won't guarantee this will work, but it might help. Who knows.

NuklearZelph

  • Guest
Re: Crash when open project
« Reply #6 on: October 18, 2005, 05:47:06 am »
i have done some wxWidgets programming and tried to compile Turbo Pad (an sf.net project)
and found it to be entirely incompatible with wx 2.5 & 2.6. i figured out it was built for 2.4.
 not that that matters so much, but that there was an incompatability between the versions.
2.4 seems to have different sizers than the newer ones. this is probably only one difference,
but in that context, shows to some extent why code::blocks doesn't want to compile on a
different wx version than it was built for.