Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Crash when changing active target
Pecan:
andLinux SVN 3558 gcc 4.0.4 Linux/unicode
Occasionaly when I change a project target via the toolbar: crash
--- Code: ---Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1230625104 (LWP 1566)]
0x08073a87 in wxStringBase::size (this=0x8ddd940)
at /usr/include/wx-2.6/wx/string.h:367
367 size_type size() const { return GetStringData()->nDataLength; }
(gdb) bt
#0 0x08073a87 in wxStringBase::size (this=0x8ddd940)
at /usr/include/wx-2.6/wx/string.h:367
#1 0x08073b2b in wxStringBase::length (this=0x8ddd940)
at /usr/include/wx-2.6/wx/string.h:369
#2 0x0809f3e1 in wxString::Len (this=0x8ddd940)
at /usr/include/wx-2.6/wx/string.h:689
#3 0x0809f543 in operator== (s1=@0xbfa40484, s2=@0x8ddd940)
at /usr/include/wx-2.6/wx/string.h:1437
#4 0xb76de3d8 in cbProject::SetActiveBuildTarget (this=0x8ddd818,
name=@0xbfa40484) at sdk/cbproject.cpp:1587
#5 0xb479f8b8 in CompilerGCC::DoUpdateTargetMenu (this=0x88e48a8,
targetIndex=2) at plugins/compilergcc/compilergcc.cpp:1235
#6 0xb47a4ce9 in CompilerGCC::OnSelectTarget (this=0x88e48a8,
event=@0xbfa40748) at plugins/compilergcc/compilergcc.cpp:2921
#7 0xb7993655 in wxAppConsole::HandleEvent ()
from /usr/lib/libwx_baseu-2.6.so.0
#8 0xb7a22b52 in wxEvtHandler::ProcessEventIfMatches ()
from /usr/lib/libwx_baseu-2.6.so.0
#9 0xb7a22c9d in wxEventHashTable::HandleEvent ()
from /usr/lib/libwx_baseu-2.6.so.0
#10 0xb7a22e1f in wxEvtHandler::ProcessEvent ()
from /usr/lib/libwx_baseu-2.6.so.0
#11 0xb7a22dbe in wxEvtHandler::ProcessEvent ()
---Type <return> to continue, or q <return> to quit---q
from /usr/lib/libwx_baseu-2.6.soQuit
(gdb) f 4
#4 0xb76de3d8 in cbProject::SetActiveBuildTarget (this=0x8ddd818,
name=@0xbfa40484) at sdk/cbproject.cpp:1587
1587 if (name == m_ActiveTarget)
(gdb) p name
$1 = (const wxString &) @0xbfa40484: {<wxStringBase> = {
static npos = 4294967295, m_pchData = 0x8e75cdc}, <No data fields>}
(gdb) p m_ActiveTarget
$2 = {<wxStringBase> = {static npos = 4294967295,
m_pchData = 0x67}, <No data fields>}
(gdb)
--- End code ---
mandrav:
Sounds like the project pointer used is invalid...
Although I can't reproduce it, can you try the following?
In src/plugins/compilergcc/compilergcc.cpp:1234, there is this code:
--- Code: --- if (m_Project)
m_Project->SetActiveBuildTarget(GetTargetString(m_TargetIndex));
--- End code ---
Replace it with this:
--- Code: --- if (Manager::Get()->GetProjectManager()->GetActiveProject())
Manager::Get()->GetProjectManager()->GetActiveProject()->SetActiveBuildTarget(GetTargetString(m_TargetIndex));
--- End code ---
Test it out for a while (a day or two) and if the crash is gone tell me to commit it.
Pecan:
--- Quote from: mandrav on February 02, 2007, 01:40:28 pm ---Sounds like the project pointer used is invalid...
Although I can't reproduce it, can you try the following?
In src/plugins/compilergcc/compilergcc.cpp:1234, there is this code:
--- Code: --- if (m_Project)
m_Project->SetActiveBuildTarget(GetTargetString(m_TargetIndex));
--- End code ---
Replace it with this:
--- Code: --- if (Manager::Get()->GetProjectManager()->GetActiveProject())
Manager::Get()->GetProjectManager()->GetActiveProject()->SetActiveBuildTarget(GetTargetString(m_TargetIndex));
--- End code ---
Test it out for a while (a day or two) and if the crash is gone tell me to commit it.
--- End quote ---
This fix seems to have done the job.
I noticed that the original problem occured while I was building a large project with a lot of targets and switching back and forth without doing an intervening save.
thanks, it saved a lot of time.
pecan
dje:
It makes me think of a bug I submitted to BerliOS :
https://developer.berlios.de/bugs/?func=detailbug&group_id=5358&bug_id=9655
I had a crash switching from a project to another one during debug sesion.
The difference is that I switched from a project to another instead of a target to another but context and crash are very similar...
Dje
Pecan:
--- Quote from: dje on February 08, 2007, 09:56:41 pm ---It makes me think of a bug I submitted to BerliOS :
https://developer.berlios.de/bugs/?func=detailbug&group_id=5358&bug_id=9655
I had a crash switching from a project to another one during debug sesion.
The difference is that I switched from a project to another instead of a target to another but context and crash are very similar...
Dje
--- End quote ---
I think you'll find that bug fixed here:
http://forums.codeblocks.org/index.php?topic=5120.msg40163#msg40163
debugger stop button on Linux console pgm crashes CB
It's caused by a "delete m_pDirver" being called while data is still in the GDBOuput queue.
I made the fix for Linux only, but there's no reason it wouldn't work for XP.
It's a temporary fix until mandrav decides how he wants to handle it.
Navigation
[0] Message Index
[#] Next page
Go to full version