https://bugs.documentfoundation.org/show_bug.cgi?id=93889

            Bug ID: 93889
           Summary: Extraordinary, un-necessary busy-loop removal ...
           Product: LibreOffice
           Version: unspecified
          Hardware: Other
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

This one is a bit of a joke:

sc/source/ui/dbgui/sfiltdlg.cxx

sets up an idle handler that runs all the time:

    pIdle = new Idle;
    // FIXME: this is an abomination
    pIdle->SetPriority( SchedulerPriority::LOWEST );
    pIdle->SetIdleHdl( LINK( this, ScSpecialFilterDlg, TimeOutHdl ) );
    pIdle->Start();

The comment:

    // Hack: RefInput-Kontrolle
    pIdle = new Idle;

Is rather accurate ;-)

Reading the actual idle handler:

    // alle 50ms nachschauen, ob RefInputMode noch stimmt
    if( (_pIdle == pIdle) && IsActive() )
    {
        if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() )
        {
            pRefInputEdit = pEdCopyArea;
            bRefInputMode = true;
        }
        else if( pEdFilterArea->HasFocus() || pRbFilterArea->HasFocus() )
        {
            pRefInputEdit = pEdFilterArea;
            bRefInputMode = true;
        }
        else if( bRefInputMode )
        {
            pRefInputEdit = NULL;
            bRefInputMode = false;
        }
    }

Unless there is some cunning operator overloading or mis-use of the HasFocus()
method somehow - then all of this could easily be renamed into a:

"SyncFocusState()"

method - and we can audit the code to find where we need to call that (ie.
before we use the pRefInputEdit or bRefInputMode members.

Might be nice to prefix the member variables with 'm' or 'm_' to taste.

Then rip the idle handler out completely and all the muck that goes with it.

Worth checking the git annotate to see why that's there too I suspect =)
perhaps there is a helpful bug report somewhere.

Thanks (for saving many people's batteries) =)

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to