Menu

#231 Assert fires in 'wxWidgets' when switching to new source file

Next_Nightly
fixed
wx30 (74)
Bug_Report
2016-01-30
2015-10-05
jmacc
No

From time to time I get the following assert firing when I switch to viewing a new source file. Usually it appears to happen when I hit F11 to switch between .h and .cpp files, I don't have a reproducible set of steps yet; it just seems to happen occassionally.

ASSERT INFO:
../src/common/wincmn.cpp(372): assert "id == wxID_ANY || (id >= 0 && id < 32767) || (id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST)" failed in CreateBase(): invalid id value

BACKTRACE:
[1] wxWindowBase::CreateBase(wxWindowBase, int, wxPoint const&, wxSize const&, long, wxString const&)
[2] wxWindowBase::CreateBase(wxWindowBase
, int, wxPoint const&, wxSize const&, long, wxValidator const&, wxString const&)
[3] wxWindow::Create(wxWindow, int, wxPoint const&, wxSize const&, long, wxString const&)
[4] wxControl::Create(wxWindow
, int, wxPoint const&, wxSize const&, long, wxValidator const&, wxString const&)
[5] wxScintilla::Create(wxWindow, int, wxPoint const&, wxSize const&, long, wxString const&)
[6] wxScintilla::wxScintilla(wxWindow
, int, wxPoint const&, wxSize const&, long, wxString const&)
[7] cbStyledTextCtrl::cbStyledTextCtrl(wxWindow, int, wxPoint const&, wxSize const&, long)
[8] cbEditor::CreateEditor()
[9] cbEditor::DoInitializations(wxString const&, LoaderBase
)
[10] cbEditor::cbEditor(wxWindow, LoaderBase, wxString const&, EditorColourSet)
[11] EditorManager::Open(LoaderBase
, wxString const&, int, ProjectFile)
[12] CompilerErrors::DoGotoError(CompileError const&)
[13] wxAppConsoleBase::CallEventHandler(wxEvtHandler
, wxEventFunctor&, wxEvent&) const
[14] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler, wxEvent&)
[15] wxEvtHandler::SearchDynamicEventTable(wxEvent&)
[16] wxEvtHandler::TryHereOnly(wxEvent&)
[17] wxEvtHandler::DoTryChain(wxEvent&)
[18] wxEvtHandler::ProcessEvent(wxEvent&)
[19] wxWindowBase::TryAfter(wxEvent&)
[20] wxWindowBase::TryAfter(wxEvent&)
[21] wxScrollHelperEvtHandler::ProcessEvent(wxEvent&)
[22] wxGenericListCtrl::SetItemState(long, long, long)
[23] CompilerMessages::FocusError(int)
[24] CompilerGCC::OnJobEnd(unsigned long, int)
[25] wxAppConsoleBase::CallEventHandler(wxEvtHandler
, wxEventFunctor&, wxEvent&) const
[26] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler, wxEvent&)
[27] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler
)
[28] wxEvtHandler::TryHereOnly(wxEvent&)
[29] wxEvtHandler::ProcessEventLocally(wxEvent&)
[30] wxEvtHandler::ProcessEvent(wxEvent&)
[31] wxEvtHandler::ProcessPendingEvents()
[32] wxAppConsoleBase::ProcessPendingEvents()
[33] wxApp::DoIdle()
[34] g_main_context_dispatch
[35] g_main_loop_run
[36] gtk_main
[37] wxGUIEventLoop::DoRun()
[38] wxEventLoopBase::Run()
[39] wxAppConsoleBase::MainLoop()
[40] CodeBlocksApp::OnRun() /home/john/third_party/codeblocks/src/src/app.cpp:852
[41] wxEntry(int&, wchar_t**)
[42] main /home/john/third_party/codeblocks/src/src/app.cpp:322
[43] __libc_start_main
[44] _start

I'm running of a build from trunk two days ago at revision 10527.

Related

Tickets: #242

Discussion

  • Teodor Petrov

    Teodor Petrov - 2015-10-05

    Can you reproduce this problem if you disable most of the plugins?
    Can you reproduce the problem right after starting codeblocks?
    If not can you remember all the things you do until it happens?

    The problem seems to be that we're getting out of wxNewIDs...
    Can you attach a debugger and tell us what is the value of the id when the assert triggers?
    Probably you'll need to build a debug version of codeblocks.

     
  • Teodor Petrov

    Teodor Petrov - 2015-10-05
    • labels: --> wx30
     
  • jmacc

    jmacc - 2015-10-06

    I've seen it happen quite quickly after start up, i.e., within a couple of minutes, so I doubt it's any kind of 'normal' id exhaustion. Other times it takes an hour or more. I disabled the doxygen plugin because it seemed to be calling wxNextId() within headers which the web says is likely a bad idea, but that didn't seem to help.

    I still don't have steps to reproduce. I'll work on that. However, on the last assert, the ID was 32843. The whole backtrace follows in case it helps.

    (gdb) backtrace
    #0  0x00007fa73ecce12d in poll () from /lib/x86_64-linux-gnu/libc.so.6
    #1  0x00007fa73e711fe4 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #2  0x00007fa73e71230a in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #3  0x00007fa73de3deb2 in gtk_dialog_run () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
    #4  0x00007fa7400a7bb4 in wxGUIAppTraits::ShowAssertDialog (this=<optimized out>, msg=...) at ../src/gtk/utilsgtk.cpp:316
    #5  0x00007fa73f7c265a in ShowAssertDialog (file=..., line=line@entry=372, func=..., cond=..., msgUser=..., traits=traits@entry=0xe1a2d0) at ../src/common/appbase.cpp:1302
    #6  0x00007fa73f7c2ced in wxAppConsoleBase::OnAssertFailure (this=this@entry=0xdb1ea0, file=<optimized out>, line=372, func=<optimized out>, cond=<optimized out>, msg=<optimized out>) at ../src/common/appbase.cpp:781
    #7  0x00007fa740081780 in wxApp::OnAssertFailure (this=0xdb1ea0, file=<optimized out>, line=<optimized out>, func=<optimized out>, cond=<optimized out>, msg=<optimized out>) at ../src/gtk/app.cpp:507
    #8  0x00007fa73f7c3081 in wxDefaultAssertHandler (file=..., line=372, func=..., cond=..., msg=...) at ../src/common/appbase.cpp:1093
    #9  0x00007fa73f7bed90 in wxOnAssert (file=file@entry=0x7fa7402ad0dd "../src/common/wincmn.cpp", line=line@entry=372, 
        func=func@entry=0x7fa7402aea82 <wxWindowBase::CreateBase(wxWindowBase*, int, wxPoint const&, wxSize const&, long, wxString const&)::__FUNCTION__> "CreateBase", 
        cond=cond@entry=0x7fa7402acaf0 "id == wxID_ANY || (id >= 0 && id < 32767) || (id >= wxID_AUTO_LOWEST && id <= wxID_AUTO_HIGHEST)", msg=msg@entry=0x7fa7402ad978 L"invalid id value") at ../src/common/appbase.cpp:1178
    #10 0x00007fa74020857f in wxWindowBase::CreateBase (this=this@entry=0x6120990, parent=parent@entry=0x6069f90, id=id@entry=32843, size=..., style=style@entry=3494117376, name=...) at ../src/common/wincmn.cpp:370
    #11 0x00007fa7402085ea in wxWindowBase::CreateBase (this=this@entry=0x6120990, parent=parent@entry=0x6069f90, id=id@entry=32843, pos=..., size=..., style=style@entry=3494117376, validator=..., name=...) at ../src/common/wincmn.cpp:412
    #12 0x00007fa7400ae3d3 in wxWindow::Create (this=this@entry=0x6120990, parent=parent@entry=0x6069f90, id=id@entry=32843, pos=..., size=..., style=3494117376, style@entry=3225681920, name=...) at ../src/gtk/window.cpp:2369
    #13 0x00007fa7400eb7e7 in wxControl::Create (this=this@entry=0x6120990, parent=parent@entry=0x6069f90, id=id@entry=32843, pos=..., size=..., style=style@entry=3225681920, validator=..., name=...) at ../src/gtk/control.cpp:51
    #14 0x00007fa741a425f7 in wxScintilla::Create (this=this@entry=0x6120990, parent=parent@entry=0x6069f90, id=id@entry=32843, pos=..., size=..., style=3221225472, style@entry=0, name=...) at src/wxscintilla.cpp:206
    #15 0x00007fa741a428dc in wxScintilla::wxScintilla (this=0x6120990, parent=0x6069f90, id=32843, pos=..., size=..., style=0, name=...) at src/wxscintilla.cpp:188
    #16 0x00007fa7418cef69 in cbStyledTextCtrl::cbStyledTextCtrl (this=0x6120990, pParent=0x6069f90, id=32843, pos=..., size=..., style=0) at cbstyledtextctrl.cpp:54
    #17 0x00007fa7418a8bd9 in cbEditor::CreateEditor (this=this@entry=0x6069f90) at cbeditor.cpp:1007
    #18 0x00007fa7418b3a0f in cbEditor::DoInitializations (this=this@entry=0x6069f90, filename=..., fileLdr=fileLdr@entry=0x15fce80) at cbeditor.cpp:773
    #19 0x00007fa7418b4680 in cbEditor::cbEditor (this=0x6069f90, parent=<optimized out>, fileLdr=0x15fce80, filename=..., theme=<optimized out>) at cbeditor.cpp:717
    #20 0x00007fa74192edc6 in EditorManager::Open (this=0x13ce6a0, fileLdr=0x15fce80, fileLdr@entry=0x0, filename=..., data=data@entry=0x0) at editormanager.cpp:392
    #21 0x00007fa74192efef in EditorManager::Open (this=<optimized out>, filename=..., pos=pos@entry=0, data=data@entry=0x0) at editormanager.cpp:353
    #22 0x00000000004db29c in ProjectManagerUI::DoOpenFile (this=this@entry=0x11cf0d0, pf=pf@entry=0x15d9400, filename=...) at projectmanagerui.cpp:762
    #23 0x00000000004dbcbe in ProjectManagerUI::DoOpenSelectedFile (this=this@entry=0x11cf0d0) at projectmanagerui.cpp:813
    #24 0x00000000004dbd91 in ProjectManagerUI::OnProjectFileActivated (this=0x11cf0d0, event=...) at projectmanagerui.cpp:1014
    #25 0x00007fa73f7bd11e in wxAppConsoleBase::CallEventHandler (this=0xdb1ea0, handler=0x11cf0d0, functor=..., event=...) at ../src/common/appbase.cpp:623
    #26 0x00007fa73f930282 in wxEvtHandler::ProcessEventIfMatchesId (entry=..., handler=<optimized out>, event=...) at ../src/common/event.cpp:1384
    #27 0x00007fa73f930333 in wxEventHashTable::HandleEvent (this=<optimized out>, event=..., self=self@entry=0x11cf0d0) at ../src/common/event.cpp:990
    #28 0x00007fa73f93068d in wxEvtHandler::TryHereOnly (this=0x11cf0d0, event=...) at ../src/common/event.cpp:1581
    #29 0x00007fa73f9304a3 in wxEvtHandler::DoTryChain (this=this@entry=0x1126ee8, event=...) at ../src/common/event.cpp:1546
    #30 0x00007fa73f930718 in wxEvtHandler::ProcessEventLocally (this=this@entry=0x1126ee8, event=...) at ../src/common/event.cpp:1514
    #31 0x00007fa73f930765 in wxEvtHandler::ProcessEvent (this=0x1126ee8, event=...) at ../src/common/event.cpp:1487
    #32 0x00007fa740207a48 in wxWindowBase::TryAfter (this=0x11cfa10, event=...) at ../src/common/wincmn.cpp:3427
    #33 0x00007fa740207a48 in wxWindowBase::TryAfter (this=0x12f0e70, event=...) at ../src/common/wincmn.cpp:3427
    #34 0x00007fa74025451b in wxScrollHelperEvtHandler::ProcessEvent (this=0x12f0970, event=...) at ../src/generic/scrlwing.cpp:202
    #35 0x00007fa740267842 in wxGenericTreeCtrl::OnMouse (this=0x12f0e70, event=...) at ../src/generic/treectlg.cpp:3891
    #36 0x00007fa73f7bd11e in wxAppConsoleBase::CallEventHandler (this=0xdb1ea0, handler=0x12f0e70, functor=..., event=...) at ../src/common/appbase.cpp:623
    #37 0x00007fa73f930282 in wxEvtHandler::ProcessEventIfMatchesId (entry=..., handler=<optimized out>, event=...) at ../src/common/event.cpp:1384
    #38 0x00007fa73f930333 in wxEventHashTable::HandleEvent (this=<optimized out>, event=..., self=self@entry=0x12f0e70) at ../src/common/event.cpp:990
    #39 0x00007fa73f93068d in wxEvtHandler::TryHereOnly (this=this@entry=0x12f0e70, event=...) at ../src/common/event.cpp:1581
    #40 0x00007fa73f930703 in TryBeforeAndHere (event=..., this=this@entry=0x12f0e70) at ../include/wx/event.h:3671
    #41 wxEvtHandler::ProcessEventLocally (this=this@entry=0x12f0e70, event=...) at ../src/common/event.cpp:1514
    #42 0x00007fa73f930765 in wxEvtHandler::ProcessEvent (this=0x12f0e70, event=...) at ../src/common/event.cpp:1487
    #43 0x00007fa74025451b in wxScrollHelperEvtHandler::ProcessEvent (this=0x12f0970, event=...) at ../src/generic/scrlwing.cpp:202
    #44 0x00007fa73f9304f7 in wxEvtHandler::SafelyProcessEvent (this=<optimized out>, event=...) at ../src/common/event.cpp:1605
    #45 0x00007fa7400af898 in gtk_window_button_press_callback (widget=<optimized out>, gdk_event=0x5ac4840, win=0x12f0e70) at ../src/gtk/window.cpp:1435
    #46 0x00007fa73deb3815 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
    #47 0x00007fa73d8923b8 in g_closure_invoke () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #48 0x00007fa73d8a3d3d in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #49 0x00007fa73d8ab6f9 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #50 0x00007fa73d8abce2 in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
    #51 0x00007fa73dfc36b4 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
    #52 0x00007fa73deb1fc4 in gtk_propagate_event () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
    #53 0x00007fa73deb237b in gtk_main_do_event () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
    #54 0x00007fa73db2c43c in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
    #55 0x00007fa73e711e04 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #56 0x00007fa73e712048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #57 0x00007fa73e71230a in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
    #58 0x00007fa73deb1447 in gtk_main () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
    #59 0x00007fa740092145 in wxGUIEventLoop::DoRun (this=0x5af0280) at ../src/gtk/evtloop.cpp:65
    #60 0x00007fa73f7ff440 in wxEventLoopBase::Run (this=0x5af0280) at ../src/common/evtloopcmn.cpp:78
    #61 0x00007fa73f7bf1fd in wxAppConsoleBase::MainLoop (this=0xdb1ea0) at ../src/common/appbase.cpp:334
    #62 0x000000000045a2e4 in CodeBlocksApp::OnRun (this=0xdb1ea0) at app.cpp:850
    #63 0x00007fa73f84b04d in wxEntry (argc=@0x7fa73fbd8190: 1, argv=<optimized out>) at ../src/common/init.cpp:495
    
     

    Last edit: jmacc 2015-10-06
  • Teodor Petrov

    Teodor Petrov - 2015-10-06

    OK. This is not helpful unfortunately.
    One other thing you could do is:
    1. Start cb under gdb, open your project, set it up
    2. ctrl-c in the gdb prompt
    3. break wxNew
    4. cont
    5. continue doing your normal work with cb
    6. just inspect the backtrace every time new id is created
    7. if you find some pattern then we'll fix it.

    See this http://slackito.com/2011/12/09/poor-mans-tracepoints-with-gdb/ if you want to automate this process.

    Also disable as many plugins as possible. If I were you I'd start with the keybinder.

    One more thing - are you using context menus a lot?

     
  • jmacc

    jmacc - 2015-10-06

    I use the 'Show file in project tree' context menu quite a bit. I also use 'Swap header / source' constantly, but only via F11 and not via the context menu itself (so I don't know if that counts for the purposes of your question.)

    I'll try the gdb thing.

     
  • jmacc

    jmacc - 2015-10-07

    Hey, thanks for the gdb trick. That's pretty neat.

    What seems to be happening is that mouse move events over an open source file generate new IDs, so they seem to go up pretty quickly. The source code is this function in ScintillaWX.cpp

    void ScintillaWX::FineTickerStart(TickReason reason, int millis, int /* tolerance */)
    {
        FineTickerCancel(reason);
    
        timers[reason] = new wxTimer(sci, wxNewId());
        timers[reason]->Start(millis);
        sci->Connect(timers[reason]->GetId(), wxEVT_TIMER, wxTimerEventHandler(wxScintilla::OnTimer));
    }
    

    (Apparently a timer needs a new id?) I put a breakpoint on wxNewID() and this back trace fires constantly when the mouse is moving.

    #0  0x00007f15d7165d50 in wxNewId()@plt () from /usr/local/lib/libcodeblocks.so.0
    #1  0x00007f15d732c8e8 in ScintillaWX::FineTickerStart (this=0x6e0ee00, reason=Editor::tickDwell, millis=1000) at src/ScintillaWX.cpp:552
    #2  0x00007f15d75053d2 in Editor::ButtonMoveWithModifiers (this=0x6e0ee00, pt=..., modifiers=modifiers@entry=0) at src/scintilla/src/Editor.cxx:4387
    #3  0x00007f15d7505877 in Editor::ButtonMove (this=<optimized out>, pt=...) at src/scintilla/src/Editor.cxx:4482
    #4  0x00007f15d732db65 in ScintillaWX::DoLeftButtonMove (this=<optimized out>, pt=..., pt@entry=...) at src/ScintillaWX.cpp:1144
    #5  0x00007f15d7331021 in wxScintilla::OnMouseMove (this=<optimized out>, evt=...) at src/wxscintilla.cpp:5323
    #6  0x00007f15d50ad11e in wxAppConsoleBase::CallEventHandler (this=0x1f3bea0, handler=0x6e0d400, functor=..., event=...) at ../src/common/appbase.cpp:623
    #7  0x00007f15d5220282 in wxEvtHandler::ProcessEventIfMatchesId (entry=..., handler=<optimized out>, event=...) at ../src/common/event.cpp:1384
    #8  0x00007f15d5220333 in wxEventHashTable::HandleEvent (this=<optimized out>, event=..., self=self@entry=0x6e0d400) at ../src/common/event.cpp:990
    #9  0x00007f15d522068d in wxEvtHandler::TryHereOnly (this=0x6e0d400, event=...) at ../src/common/event.cpp:1581
    #10 0x00007f15d52204a3 in wxEvtHandler::DoTryChain (this=this@entry=0x6e282b0, event=...) at ../src/common/event.cpp:1546
    #11 0x00007f15d5220718 in wxEvtHandler::ProcessEventLocally (this=this@entry=0x6e282b0, event=...) at ../src/common/event.cpp:1514
    #12 0x00007f15d5220765 in wxEvtHandler::ProcessEvent (this=0x6e282b0, event=...) at ../src/common/event.cpp:1487
    #13 0x00007f15d52204f7 in wxEvtHandler::SafelyProcessEvent (this=<optimized out>, event=...) at ../src/common/event.cpp:1605
    #14 0x00007f15d599fc5c in gtk_window_motion_notify_callback (gdk_event=<optimized out>, win=0x6e0d400) at ../src/gtk/window.cpp:1606
    

    Is that the problem? Do you need any other info?

     

    Last edit: jmacc 2015-10-07
  • ollydbg

    ollydbg - 2015-10-07

    Here is my obverse and suggest:
    In sdk\wxscintilla\src\scintilla\src\Editor.h

    enum TickReason { tickCaret, tickScroll, tickWiden, tickDwell, tickPlatform };

    And in sdk\wxscintilla\src\ScintillaWX.h
    wxTimer* timers[tickDwell+1];

    So, we can create an array like above, also, I think they can be static member variables
    static int timerIds[tickDwell+1];

    Note tested yet.

     
  • ollydbg

    ollydbg - 2015-10-07

    Firsty, I try to looked at wxWidgts' git repo, and I see it doesn't use several times: wxWidgets/src/stc/ScintillaWX.cpp, so no reference here.

    Next, I looked at the official scintilla package: zip format, there are some implementation such as scintillaQT and scintillaGTK.

    In QT implemantation, it has:

    void ScintillaQt::timerEvent(QTimerEvent *event)
    {
        for (TickReason tr=tickCaret; tr<=tickDwell; tr = static_cast<TickReason>(tr+1)) {
            if (timers[tr] == event->timerId()) {
                TickFor(tr);
            }
        }
    }
    

    Sounds like it directly compare the timer id, not the event id, since timers is an int array, since it is initilized like below:

        for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast<TickReason>(tr + 1)) {
            timers[tr] = 0;
        }
    

    The GTK version use a structure:

        struct TimeThunk {
            TickReason reason;
            ScintillaGTK *scintilla;
            guint timer;
            TimeThunk() : reason(tickCaret), scintilla(NULL), timer(0) {}
        };
        TimeThunk timers[tickDwell+1];
    

    while, it just store the "reason" (enum type) as the type, and when time out happens, it just know which timer event is arrived

    int ScintillaGTK::TimeOut(TimeThunk *tt) {
        tt->scintilla->TickFor(tt->reason);
        return 1;
    }
    

    Now, back to our implemantation, we have such code:

    /* C::B begin */
    void ScintillaWX::DoOnTimer(wxTimerEvent& evt) {
        for (TickReason tr=tickCaret; tr<=tickDwell; tr = static_cast<TickReason>(tr+1)) {
            if (timers[tr] && timers[tr]->GetId() == evt.GetId()) {
                TickFor(tr);
            }
        }
    }
    /* C::B end */
    

    So, my idea which could be much eaiser is that, why not directly compare the "wxTimer"? Since in the wxTimeEvent?

    class WXDLLIMPEXP_BASE wxTimerEvent : public wxEvent
    {
    public:
        wxTimerEvent()
            : wxEvent(wxID_ANY, wxEVT_TIMER) { m_timer=NULL; }
    
        wxTimerEvent(wxTimer& timer)
            : wxEvent(timer.GetId(), wxEVT_TIMER),
              m_timer(&timer)
        {
            SetEventObject(timer.GetOwner());
        }
    
        // accessors
        int GetInterval() const { return m_timer->GetInterval(); }
        wxTimer& GetTimer() const { return *m_timer; }
    
        // implement the base class pure virtual
        virtual wxEvent *Clone() const { return new wxTimerEvent(*this); }
        virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_TIMER; }
    
    private:
        wxTimer* m_timer;
    
        DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTimerEvent)
    };
    

    But it looks like we can't the wxTimer pointer from this event, so I think the static timerIds are still good method.

    BTW: is it possible to just pass the enum value as the ID?

    timers[reason] = new wxTimer(sci, reason);
    
     
  • Teodor Petrov

    Teodor Petrov - 2015-10-07

    Nope, we have to pass real ID I think.
    Interesting this timer code is not present in the wxSTC in wx-master branch.

    @Morten: Can you tell us why do you need this?

     
  • ollydbg

    ollydbg - 2015-10-07

    @OBF:
    See: Scintilla and SciTE
    The release of 3.5.0

    Separate timers are used for each type of periodic activity and they are turned on and off as required. This saves power as there are fewer wake ups. On recent releases of OS X Cocoa and Windows, coalescing timers are used to further save power.

    I think wxSTC just doesn't implement this feature.

     
  • Morten MacFly

    Morten MacFly - 2015-10-07

    Yes, wxSTC is far behind our version. But for the next upgrade they will need to implement something similar, too.

    For now, I think ollydbg's proposal is good enough: Limit the ID's for the possible max. number of parallel timers. When the timer is freed, you can also release ID's for re-use or to track if its really not used any longer.

    I wasn't aware that this could become a problem when I implemented the function.

    (And sorry, just today I read this ticket.)

     
  • Teodor Petrov

    Teodor Petrov - 2015-10-07

    I think, I'll contact scintilla people first. To see if I can use the same ids/timers for different editors. Because if we allocate N ids per editor, then we'll deplete the id pool after 500-1000 editors are opened closed. And this is not that higher number.

     
    • ollydbg

      ollydbg - 2015-10-07

      I think using the same ids for different editors are quite safe. But we should use different timers. (we use ids as they are static menber variables, and timers are allocated in heap).

       
  • Teodor Petrov

    Teodor Petrov - 2015-10-07

    Please test and review the attached patch.
    I don't like calling new every time a timer is created thus I've move the code to the constructor/destructor. I doubt it will affect the performance much.

     
  • Teodor Petrov

    Teodor Petrov - 2015-10-07
    • assigned_to: Teodor Petrov
    • Type: Undefined --> Bug_Report
    • Milestone: Undefined --> Next Nightly
     
  • jmacc

    jmacc - 2015-10-08

    I've applied that patch and have been running the code for a few hours. Normally I would have seen the assert by now, but so far I haven't seen it. I've also seen no adverse affects so far as I can tell.

     
  • jmacc

    jmacc - 2015-10-09

    I've been running the patch for a couple of days now. The asserts are gone. I don't see any new issues.

     
  • Teodor Petrov

    Teodor Petrov - 2015-10-09

    @Morten: Can you look at the patch to see if I'm not doing something stupid?

     
  • ollydbg

    ollydbg - 2015-10-09

    My comments: I read your patch days ago, I didn't see any flaws. Good work!

     
  • Teodor Petrov

    Teodor Petrov - 2015-10-15
    • status: open --> fixed
     
  • Teodor Petrov

    Teodor Petrov - 2015-10-15

    Fix in trunk/master.

     
  • jmacc

    jmacc - 2015-10-15

    @Teodor: Thanks!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.