Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Redundant Crash in CCManager::OnShowCallTip()

<< < (2/5) > >>

oBFusCATed:

--- Quote from: darksquall57 on August 11, 2015, 09:33:39 am ---you mean calling "./configure --enable-debug" ?

--- End quote ---
If you're building cb yourself then yes.
If you're using binary packages then there is a package that has debug info in it. You have to just install it.

ollydbg:
About the crash issue: I firstly guess this is the thread issue, but when I check the code, I see that in ccmanager

--- Code: ---void CCManager::OnShowCallTip(CodeBlocksEvent& event)
{
    event.Skip();

    int tooltipMode = Manager::Get()->GetConfigManager(wxT("ccmanager"))->ReadInt(wxT("/tooltip_mode"), 1);
    // 0 - disable
    // 1 - enable
    // 2 - force single page
    // 3 - keybound only
    if (tooltipMode == 0)
        return;

    cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
    if (!ed)
        return;

    cbCodeCompletionPlugin* ccPlugin = GetProviderFor(ed);
    if (!ccPlugin)
        return;

    cbStyledTextCtrl* stc = ed->GetControl();
    if (!stc)
        return;

    int pos = stc->GetCurrentPos();
    int argsPos = wxSCI_INVALID_POSITION;
    wxString curTip;
    if (!m_CallTips.empty())
        curTip = m_CurCallTip->tip;
    m_CallTips = ccPlugin->GetCallTips(pos, stc->GetStyleAt(pos), ed, argsPos);
    ...

--- End code ---
When call the ccPlugin's GetCallTips() function, I see that there is a check:

--- Code: ---std::vector<CodeCompletion::CCCallTip> CodeCompletion::GetCallTips(int pos, int style, cbEditor* ed, int& argsPos)
{
    std::vector<CCCallTip> tips;
    if (!IsAttached() || !m_InitDone || style == wxSCI_C_WXSMITH || !m_NativeParser.GetParser().Done())
        return tips;

    int typedCommas = 0;
    wxArrayString items;
    ...

--- End code ---
You see, there is a check "!m_NativeParser.GetParser().Done()", This means there is no other thread running on the TokenTree(At least in the active Parser object), so my question is: do you open several cbp projects in C::B? This is the chance that other Parser objects are running parsing jobs in its thread pool.

Another guess: as Morten has once said the crash line is here

--- Code: ---curTip = m_CurCallTip->tip;
--- End code ---
My guess is that if m_CurCallTip(an iterator) could point to wrong elements of the m_CallTips(vector)?
EDIT: Maybe, you have two ccPlugins, and with one plugin, you have update the iterator, but this iterator point to the vector updated by another ccPlugin. (This is just a guess)

Since I don't have a chance to reproduce this crash issue, I have all my guesses by reading the CC and CCmanager's source code.



 

ollydbg:
@Alpha, can you explain what the meaning of  "// search long term recall" and "// search short term recall" in the function void CCManager::OnShowCallTip(CodeBlocksEvent& event)?

I can't quite understand the related code snippet. Since you have some directory, and hash code in those code.

My guess is that you want to enable a cache?  For example:


--- Code: ---void f(int a, float b, double c); 
void f(char d, void *h);

--- End code ---

When user select a call tip of function "void f(char d, void *h);" in the call tip window, the next time when the call tip window is shown, the "void f(char d, void *h);"  is automatically selected?

Thanks.

ollydbg:
I found that one issue is that sometimes, the tip window doesn't cancel correctly.


--- Code: ---void cbStyledTextCtrl::CallTipCancel()
{
    if (!m_tabSmartJump)
        wxScintilla::CallTipCancel();
}

--- End code ---
This is called inside the DoShowTips() function.

--- Code: ---void CCManager::DoShowTips(const wxStringVec& tips, cbStyledTextCtrl* stc, int pos, int argsPos, int hlStart, int hlEnd)
{
    ...
    if (stc->CallTipActive() && m_LastTipPos != pos)
        stc->CallTipCancel(); // force tip popup to invalidate (sometimes fails to otherwise do so on Windows)
    stc->CallTipShow(pos, tip);
    if (hlStart >= 0 && hlEnd > hlStart)
        stc->CallTipSetHighlight(hlStart, hlEnd);
    m_LastTipPos = pos;
}

--- End code ---

stc->CallTipCancel();  won't actually cancel the calltip, because the m_tabSmartJump==true.
Later, we call stc->CallTipShow() again.

EDIT: I see that in this case, another calltip is allocated from the wxScintilla..... So, how about the first calltip?

ollydbg:
Oh, I see some code snippet:

--- Code: ---// cbEVT_EDITOR_TOOLTIP
void CCManager::OnEditorTooltip(CodeBlocksEvent& event)
{
    ...
    if (!ccPlugin || pos < 0 || pos >= stc->GetLength())
    {
        if (stc->CallTipActive() && event.GetExtraLong() == 0 && m_CallTipActive == wxSCI_INVALID_POSITION)
            static_cast<wxScintilla*>(stc)->CallTipCancel();
        return;
    }

--- End code ---
Here, why you use the static_cast<wxScintilla*>(stc)->CallTipCancel();? You want to skip the condition check on m_tabSmartJump? and force to cancel it?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version