Audacity Bug Summary
••• Introduction •••
••• Keywords •••
    Audacity 3.0.3 development began 19th April 2021

Audacity Bugzilla



Bug 2182 - Updating Audacity can cause messed up toolbar layout
Updating Audacity can cause messed up toolbar layout
Status: RESOLVED FIXED
Product: Audacity
Classification: Unclassified
Component: User Interface
2.3.3
Per OS All
: P3 RepeatableAll
Assigned To: Default Assignee for New Bugs
: upgraders
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-07-31 14:09 UTC by David Bailes
Modified: 2019-08-30 07:53 UTC (History)
7 users (show)

See Also:
Steps To Reproduce:
1. Take a audacity.cfg file from Audacity 2.1.2 or earlier 2. Use file with Audacity 2.3.0 or latter. 3. When Audacity opens, the toolbars in the top tooldock may have a messed up layout.
Release Note:
Group: Updating *Updating Audacity 2.1.2 or earlier to 2.3.0 or latter may result in a messed up toolbar layout - toolbars on top of each other.
First Git SHA: a90c6c45f38bc98350882d18873d03d6602cb1b5
Group: ---
Workaround:
View > Toolbars > Reset Toolbars
Closed: 2019-08-30 00:00:00
james.k.crook: Must‑Test‑All‑OS-
james.k.crook: Regression+
petersampsonaudacity: Test‑OK‑Win+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Bailes 2019-07-31 14:09:07 UTC
Updating Audacity 2.1.2 or earlier to 2.3.0 or latter results in a messed up toolbar layout - toolbars on top of each other.


Caused by this commit:

Author:	Paul Licameli <paul.licameli@audacityteam.org>
Author date:	2 years ago (22/01/2018 03:22:45)
Commit date:	11 months ago (15/09/2018 23:24:16)
Commit hash:	a90c6c45f38bc98350882d18873d03d6602cb1b5
Child:	20b7a495ce
Parent:	01634938cc

Remove redundant calls to update toolbars
Comment 1 James Crook 2019-07-31 17:54:51 UTC
Uprating from P3 to P2 as it's a regression
Comment 2 David Bailes 2019-08-02 06:52:32 UTC
The problem appears to be caused by the following if statement in void ToolManager::ReadConfig():

if (someFound &&
             t->GetType() == ScrubbingBarID) {
            // Special case code to put the NEW scrubbing toolbar where we
            // want it, when audacity.cfg is present from an older version

......
}

The scrubbing toolbar was introduced in 2.1.3.
Removing completely that if statement fixes the bug.
That would be my suggested fix - I have no inclination to investigate any further.

However, a developer may want to do something different.
Comment 3 Peter Sampson 2019-08-29 08:09:00 UTC
Demoting this to P3 - there is a very simple workaround documented - plus we are gerring #diminishingly few reports of this on the Forum.
Comment 4 David Bailes 2019-08-29 08:38:21 UTC
(In reply to David Bailes from comment #2)
> The problem appears to be caused by the following if statement in void
> ToolManager::ReadConfig():
> 
> if (someFound &&
>              t->GetType() == ScrubbingBarID) {
>             // Special case code to put the NEW scrubbing toolbar where we
>             // want it, when audacity.cfg is present from an older version
> 
> ......
> }
> 
> The scrubbing toolbar was introduced in 2.1.3.
> Removing completely that if statement fixes the bug.
> That would be my suggested fix - I have no inclination to investigate any
> further.
> 
> However, a developer may want to do something different.

Paul or James: do you have an opinion on this suggested fix? I am happy to commit it, if it's considered to be OK.
Comment 5 James Crook 2019-08-29 17:22:14 UTC
That code change (comment #4) doesn't look right.  The code in the 'if' is supposed to be just for scrubbing bar, so how is it right to make it apply to all toolbars?  Why does it 'work'?  I don't see how it relates to the commit by Paul that comment #0 says caused the problem.

Without an explanation for why the new changed code is better (which is not obvious) I don't want to take this change.  For all I know it causes other problems with toolbar layout.

WITH comments explaining what the corrected code is doing and why, this could be a valid fix.

I presume the following code would be deleted too:

         // Dock it
         d->Dock( t, false );

         // Show or hide the bar
         Expose( t->GetId(), show[ t->GetId() ] );
Comment 6 David Bailes 2019-08-30 04:00:41 UTC
(In reply to James Crook from comment #5)
> That code change (comment #4) doesn't look right.  The code in the 'if' is
> supposed to be just for scrubbing bar, so how is it right to make it apply
> to all toolbars?  Why does it 'work'?

By removing the if statement, I meant removing all the following code, that is the entire if statement, and not just the condition:
         if (someFound &&
             t->GetType() == ScrubbingBarID) {
            // Special case code to put the NEW scrubbing toolbar where we
            // want it, when audacity.cfg is present from an older version
            ToolBar *lastRoot {};

            // Change from the ideal configuration to the constrained one,
            // just as when dragging and dropping
            ToolBarConfiguration dummy;
            mTopDock->WrapConfiguration(dummy);

            // Start a NEW row with just the scrubbing toolbar
            auto &configuration = mTopDock->GetConfiguration();
            for (const auto place : configuration)
               if (place.position.rightOf == nullptr)
                  lastRoot = place.pTree->pBar;
            ToolBarConfiguration::Position position {
               nullptr, lastRoot, false
            };
            mTopDock->Dock(t, false, position);

            // Reposition the device toolbar, if it was docked above,
            // right of scrubbing
            const auto deviceToolBar = mBars[ DeviceBarID ].get();
            if (deviceToolBar->GetDock() == mTopDock) {
               deviceToolBar->GetDock()->Undock(deviceToolBar);
               position = ToolBarConfiguration::Position{ t, nullptr };
               mTopDock->Dock(deviceToolBar, false, position);

               // Remember not to place the device toolbar again
               deviceWasPositioned = true;
            }
            Expose( t->GetId(), show[ t->GetId() ] );
            continue;
         }

and this if statement can also be removed:
           if (deviceWasPositioned &&
             t->GetType() == DeviceBarID)
            continue;


  I don't see how it relates to the
> commit by Paul that comment #0 says caused the problem.

I don't know why Paul's commit caused the problem. I've had a look at Paul's code for positioning the toolbars, and decided it would take a long time to be able to understand it.

The code I'm suggesting to remove relates only to the positioning of the scrubbing toolbar. I would assume that this positioning is now of very little importance.

I don't know what is going wrong in the code I'm suggesting removing because I'm not familiar enough with Paul's positioning code, but removing it does fix the problem.

> 
> Without an explanation for why the new changed code is better (which is not
> obvious) I don't want to take this change.  For all I know it causes other
> problems with toolbar layout.
> 
> WITH comments explaining what the corrected code is doing and why, this
> could be a valid fix.

As I've already said, I can't provide a complete explanation of the problem. Ideally, this bug should be fixed by someone who is more familiar with the code.

> 
> I presume the following code would be deleted too:
> 
>          // Dock it
>          d->Dock( t, false );
> 
>          // Show or hide the bar
>          Expose( t->GetId(), show[ t->GetId() ] );

No, that code would remain.
Comment 7 James Crook 2019-08-30 04:37:39 UTC
DEVEL - FIX MADE
https://github.com/audacity/audacity/commit/9e69be9f6fb8589dbced06391a8ac945a0a10db1

Thanks David.  I'm happy with that code vanishing.  The comments suggest it was only relevant to upgraders, and since it causes problems for upgraders it can go - making our code much more readable.  It is irrelevant once a user has saved a new layout.

I think there are other bugs with toolbar layout.  I got an issue where toolbars stopped flowing on resizing the window, but I could not reproduce it, so I did not log it.  Anyway, it is not THIS bug, and if it is seen again should be logged as a new bug.
Comment 8 Peter Sampson 2019-08-30 07:53:00 UTC
Tested on W10 with audacity-2.3.3-alpha-338-9e69be9f6fb8589dbced06391a8ac945a0a10db1

This looks to be properly fixed ...


Tested against 2.3.0 and the alpha 2.3.3 build 337 (one immediately prior) and on both of those I get the jumbled toolbars when I "upgrade" from 2.1.2 audacity settings.

But when I run the latest 338 alpha afyet an "upgrade" from 2.1.2 the toolbars are absolutely fine.

Also tested adding in the  Scrubbing Toolbar  which docked nicely in the upper tooldock - and the Spectral Selection Toolbarwhich docked nicely in the lower tooldock.