User forums > Using Code::Blocks

C::B crash (Settings-->Editor)

<< < (9/16) > >>

Michael:

--- Quote from: Pecan on April 18, 2006, 04:40:01 am ---Michael,
Would you change statement at line 224 to the following to see
if wxgtk is miscalculating the string length.


--- Code: ---    languages[0].name = wxString(_T("C/C++"),14);

--- End code ---

--- End quote ---

Done.

I get the same error(s) as depicted above.

Best wishes,
Michael

Zlika:
Just to be sure, do you have the same problem when executing the plugin? (it should execute the same function if the settings are missing, but I want to be sure the error is not related to the way CB load the "settings->editor" forms).

Michael:

--- Quote from: Zlika on April 18, 2006, 06:38:31 pm ---Just to be sure, do you have the same problem when executing the plugin? (it should execute the same function if the settings are missing, but I want to be sure the error is not related to the way CB load the "settings->editor" forms).

--- End quote ---

I not yet give a try to it in Linux. In Windows I have used it 2-3 times. Let me check and I will report.

[EDIT]: If I try to use codestats plugin, C::B crashes with the same errors as Settings-->Editor.

Best wishes,
Michael

Pecan:
The following is the backtrace and code causing the crash.
the "name" string data pointer inside the languages array is never initialized to wxEmptyString on gtk.

GetStringData() is returning m_pchData as 0x0 -1 or (0xfffffff4) as
the address of the languages[].name wxString data.

The culprit is Statement 801: GetStringData()->Unlock();
Now...
Why is languages[].name data pointer not being constructed? Its being set to
all 0x0's

Is it possible that name *is* being constructed, then the non wxWidget array
"languages" is being cleared because languages is not holding pointers
but objects?

I'll test that conjecture next.


--- Code: ---Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1230338368 (LWP 30464)]
0x0806e494 in wxStringData::IsEmpty (this=0xfffffff4) at string.h:219
219       bool  IsEmpty()   const { return (nRefs == -1); }
(gdb) bt
#0  0x0806e494 in wxStringData::IsEmpty (this=0xfffffff4) at string.h:219
#1  0x0806e4fc in wxStringData::Unlock (this=0xfffffff4) at string.h:236
#2  0xb78e5569 in wxStringBase::operator= (this=0x8822644,
    stringSrc=@0xbfa66a20) at ../src/common/string.cpp:801
#3  0x0806ea4b in wxString::operator= (this=0x8822644) at string.h:610
#4  0xb52767b1 in LoadDefaultSettings (languages=0x8822644)
    at codestatconfig.cpp:224
#5  0xb52770c3 in LoadSettings (languages=0x8822644) at codestatconfig.cpp:297
#6  0xb527787c in CodeStatConfigDlg (this=0x88224e0, parent=0x8a5e518)
    at codestatconfig.cpp:42
#7  0xb527275d in CodeStat::GetConfigurationPanel (this=0x88540b0,
    parent=0x8a5e518) at codestat.cpp:80
#8  0xb76b20f0 in PluginManager::GetConfigurationPanels (this=0x8a040b0,
    group=4, parent=0x8a5e518, arrayToFill=@0xbfa6718c)
    at sdk/pluginmanager.cpp:454
#9  0xb7655632 in EditorConfigurationDlg::AddPluginPanels (this=0xbfa66f98)
    at sdk/editorconfigurationdlg.cpp:258
#10 0xb765adaa in EditorConfigurationDlg (this=0xbfa66f98, parent=0x8338098)
    at sdk/editorconfigurationdlg.cpp:234
#11 0xb766d512 in EditorManager::Configure (this=0x846ac38)
    at sdk/editormanager.cpp:264
#12 0x08093cd5 in MainFrame::OnSettingsEditor (this=0x8338098,
    event=@0xbfa67524) at src/main.cpp:2976
#13 0xb7885a99 in wxAppConsole::HandleEvent (this=0x8130ea0,
    handler=0x8338098, func=
      {__pfn = 0x8093ca8 <MainFrame::OnSettingsEditor(wxCommandEvent&)>, __delta = 0}, event=@0xbfa67524) at ../src/common/appbase.cpp:320
#14 0xb79246d2 in wxEvtHandler::ProcessEventIfMatches (entry=@0x80eb298,
    handler=0x8338098, event=@0xbfa67524) at ../src/common/event.cpp:1185
#15 0xb7924abb in wxEventHashTable::HandleEvent (this=0x80eb4d8,
    event=@0xbfa67524, self=0x8338098) at ../src/common/event.cpp:867
#16 0xb7925a33 in wxEvtHandler::ProcessEvent (this=0x8338098,
---Type <return> to continue, or q <return> to quit---q
event=@0xbfa67524)Quit
(gdb) l
867     ../src/common/event.cpp: No such file or directory.
        in ../src/common/event.cpp
(gdb)

// assigns one string to another
wxStringBase& wxStringBase::operator=(const wxStringBase& stringSrc)
{
  wxASSERT( stringSrc.GetStringData()->IsValid() );

  // don't copy string over itself
  if ( m_pchData != stringSrc.m_pchData ) {
    if ( stringSrc.GetStringData()->IsEmpty() ) {
      Reinit();
    }
    else {
      // adjust references
      GetStringData()->Unlock();    <==== crash victim =====
      m_pchData = stringSrc.m_pchData;
      GetStringData()->Lock();
    }
  }

  return *this;
}

--- End code ---

Pecan:

--- Quote ---Is it possible that name *is* being constructed, then the non wxWidget array
"languages" is being cleared because languages is not holding pointers
but objects?

--- End quote ---

Bad news. languages[].name is actually being constructed as
as an array and being set to 0x0.

Note that all the other strings
are being constructed as wxEmptyString's.

Here are the results just after languages is constructed in CodeStatConfigDlg.

--- Code: ---0xb76b957f in LanguageDef (this=0x86ec874) at sdk/projectfileoptionsdlg.cpp:54
54      {
(gdb) n
CodeStatConfigDlg (this=0x86ec6f0, parent=0x85a7788) at codestatconfig.cpp:39
39          wxXmlResource::Get()->LoadPanel(this, parent, _("dlgCodeStatConfig"));(gdb) l
34
35      /** Load the language settings and display the configuration dialog.
36       */
37      CodeStatConfigDlg::CodeStatConfigDlg(wxWindow* parent)
38      {
39          wxXmlResource::Get()->LoadPanel(this, parent, _("dlgCodeStatConfig"));40
41          // Load the languages parameters
42          nb_languages = LoadSettings(languages);
43
(gdb) p languages[0].name
$1 = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0x0}, <No data fields>}  <==== constructed to 0x0 =====
(gdb) p languages[0].single_line_comment
$2 = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0xb795235c}, <No data fields>}
(gdb) p languages[0].multiple_line_comment[0]
$3 = {<wxStringBase> = {static npos = 4294967295,
    m_pchData = 0xb795235c}, <No data fields>}
(gdb)

--- End code ---

I'll spend some time trying to find why this is happening.
Then I'll work on a workaround.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version