Skip to content

Added context to docks#2

Open
Eism wants to merge 2 commits into
musescore:2.4from
Eism:context_fix
Open

Added context to docks#2
Eism wants to merge 2 commits into
musescore:2.4from
Eism:context_fix

Conversation

@Eism
Copy link
Copy Markdown

@Eism Eism commented May 14, 2026

TODO (fix later): Also muted assertions in Item.cpp - unfortunately, there were a lot of crashes in MuseScore

Port of musescore/MuseScore#32247

Eism added 2 commits May 14, 2026 14:19
KDDockWidgets sprinkles invariant asserts across the layout-resize path (ItemBoxContainer::growItem's `toSteal <= available1 + available2` plus the two inner `assert(availableX >= toSteal)`, Item::resizeChildren's `newItemLength > 0`, and etc.). They fire in a number of normal, non-pathological scenarios - restoring a layout into a host view that hasn't reached its final size yet, plain page switches in DockWindow when neighbour placeholders haven't accrued a shrink budget, etc. - and crash debug builds even though release builds fall through and the next onResize corrects the geometry.
@Eism Eism mentioned this pull request May 14, 2026
Comment thread src/core/DockRegistry.cpp
DockRegistry::DockRegistry(int ctx, Core::Object *parent)
: DockRegistry(parent)
{
const_cast<int &>(m_ctx) = ctx;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think better

DockRegistry::DockRegistry(int ctx, Core::Object *parent)
    : DockRegistry(parent), m_ctx(ctx)
{

Comment thread src/core/DockRegistry.h
static DockRegistry *self();

///@brief Returns the DockRegistry bound to the given context. Owned by ContextData.
static DockRegistry *self(int ctx);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing that confuses me is:

  • How can we ensure that self(ctx) is called everywhere, and not self(), if context is used?
  • How can we show other developers that they need to call self(ctx) and pass context in new code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants