Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Clang CC

<< < (44/48) > >>

BlueHazzard:
And an other crash report:

--- Code: ---77B9E49B 2B27A350 0ABEF9C0 0FBA7650  ntdll.dll!0x2e49b
77B9E0A3 040C0000 00000000 2B27A350  ntdll.dll!_RtlFreeHeap@12
754C98CD 2B27A350 2B27A350 0004F980  msvcrt.dll!_free
033C793D 2DDE13EC 034FDDAC FFFFFFFF  wxmsw28u_gcc_custom.dll!wxWCharBuffer::~wxWCharBuffer
0A3039BF 0ABEF928 2DDE13EC 7FCE500D  clanglib.dll!FromUTF8  [wxWidgets-2.8.12/include/wx/buffer.h @ 127]
   125: #endif // wxABI_VERSION >= 20804
   126:
>  127: DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA);
   128: #if wxABI_VERSION >= 20804
   129: DEFINE_WRITABLE_BUFFER(wxWritableCharBuffer, wxCharBuffer, char);
0A2C834E 2EA192D8 0ABEFA2C 00000001  clanglib.dll!UpdateIncludeDiagnosticsVisitor  [ClangLib/src/translationunit.cpp @ 630]
   628:
   629:     str = clang_getFileName(included_file);
>  630:     wxString includedFileName = wxString::FromUTF8(clang_getCString(str));
   631:     clang_disposeString(str);
   632:     if (data->errorIncludes.find( includedFileName ) != data->errorIncludes.end())

--- End code ---

yvesdm3000:

--- Quote from: MortenMacFly on February 27, 2017, 07:06:00 am ---
--- Quote from: BlueHazzard on February 27, 2017, 01:17:55 am --->   55:             if (FileTypeOf(f->relativeFilename) == ftHeader &&

--- End quote ---
I would also verify "f"not being NULL:
if (f && FileTypeOf(f->relativeFilename) == ftHeader &&
...especially on shut-down.

--- End quote ---

Sorry this is in compiler.dll and not in the clanglib plugin.

Yves

yvesdm3000:

--- Quote from: BlueHazzard on March 01, 2017, 05:01:06 pm ---And an other crash report:

--- Code: ---77B9E49B 2B27A350 0ABEF9C0 0FBA7650  ntdll.dll!0x2e49b
77B9E0A3 040C0000 00000000 2B27A350  ntdll.dll!_RtlFreeHeap@12
754C98CD 2B27A350 2B27A350 0004F980  msvcrt.dll!_free
033C793D 2DDE13EC 034FDDAC FFFFFFFF  wxmsw28u_gcc_custom.dll!wxWCharBuffer::~wxWCharBuffer
0A3039BF 0ABEF928 2DDE13EC 7FCE500D  clanglib.dll!FromUTF8  [wxWidgets-2.8.12/include/wx/buffer.h @ 127]
   125: #endif // wxABI_VERSION >= 20804
   126:
>  127: DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA);
   128: #if wxABI_VERSION >= 20804
   129: DEFINE_WRITABLE_BUFFER(wxWritableCharBuffer, wxCharBuffer, char);
0A2C834E 2EA192D8 0ABEFA2C 00000001  clanglib.dll!UpdateIncludeDiagnosticsVisitor  [ClangLib/src/translationunit.cpp @ 630]
   628:
   629:     str = clang_getFileName(included_file);
>  630:     wxString includedFileName = wxString::FromUTF8(clang_getCString(str));
   631:     clang_disposeString(str);
   632:     if (data->errorIncludes.find( includedFileName ) != data->errorIncludes.end())

--- End code ---

--- End quote ---

I wrote a little sikuliscript to reproduce this issue by continuously opening and closing projects and the same trace as you show here is there on a CentOS7 system. I think the problem comes from the fact that wxString is not thread safe since it is doing a double free of the wxString data and I pass these wxString objects between threads. Normally I try to keep these wxString objects created&destroyed on the same thread or deep-copied if they need to be handed over from one thread to another. It's probably better if I switch to std::string for anything that crosses these threads and force c++11 to assure thread-safety. I'll make a POC and see if that improves reliability.

Yves

ollydbg:

--- Quote from: yvesdm3000 on March 07, 2017, 02:15:09 pm --- It's probably better if I switch to std::string for anything that crosses these threads and force c++11 to assure thread-safety. I'll make a POC and see if that improves reliability.

--- End quote ---
wxString in wxWidgets 2.8.12 is not thread safe, and it should be thread safe in wxWidgets 3.0+, because it use std::string, and std::string is atomic reference counted.  There is same issue in the native CC, and it's hard to solve unless we move to wx3.0+.

What does POC mean?  Prove of Concept?

BlueHazzard:
Hi, sorry i forget to answer and report my findings:


--- Code: ---77B9E0A3 040C0000 00000000 2B27A350  ntdll.dll!_RtlFreeHeap@12
754C98CD 2B27A350 2B27A350 0004F980  msvcrt.dll!_free
033C793D 2DDE13EC 034FDDAC FFFFFFFF  wxmsw28u_gcc_custom.dll!wxWCharBuffer::~wxWCharBuffer
0A3039BF 0ABEF928 2DDE13EC 7FCE500D  clanglib.dll!FromUTF8  [wxWidgets-2.8.12/include/wx/buffer.h @ 127]
   125: #endif // wxABI_VERSION >= 20804
   126:
>  127: DEFINE_BUFFER(wxCharBuffer, char, wxStrdupA);
   128: #if wxABI_VERSION >= 20804
   129: DEFINE_WRITABLE_BUFFER(wxWritableCharBuffer, wxCharBuffer, char);
0A2C834E 2EA192D8 0ABEFA2C 00000001  clanglib.dll!UpdateIncludeDiagnosticsVisitor  [ClangLib/src/translationunit.cpp @ 630]
   628:
   629:     str = clang_getFileName(included_file);
>  630:     wxString includedFileName = wxString::FromUTF8(clang_getCString(str));
   631:     clang_disposeString(str);
   632:     if (data->errorIncludes.find( includedFileName ) != data->errorIncludes.end())
--- End code ---
about this crash: I replaced the function

--- Code: ---wxString::FromUTF8(clang_getCString(str))
--- End code ---
with (pseudocode, have the actual code at home)

--- Code: ---wxString clang_to_wxString(clangstring* str)
{
if(str == nullptr)
return wxEmptyString;
else
return wxString::FromUTF8(clang_getCString(str));
}
--- End code ---

and i have no crashes with this bt so far, but i tested it not that much.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version