musescore / musescore/MuseScore

[API] Clones that are not added to score cause application crash on quit

Open
#28,754 1 comment 0 reactions 2 assignees View on GitHub

Nobody has claimed this yet.

crash needs review plugins
Dominant language
C++
Stars
15.1k
Forks
3.3k
Avg merge
2d 2h
Merged PRs (30d)
91

Description

Issue type

Crash or freeze

Description with steps to reproduce

Consider this simple plugin:

import QtQuick
import MuseScore 3.0

MuseScore {
    title: "clone clone"
    onRun: {
        curScore.startCmd("clone clone")
        for (var i in curScore.selection.elements) {
            if (curScore.selection.elements[i].type == Element.NOTE) {
                curScore.selection.elements[i].parent.add(curScore.selection.elements[i].clone().clone())
            }
        }
        curScore.endCmd()
    }
}

Running it works as expected: selected notes are duplicated and added to the score.
However, when closing the application (not the score) a crash is observed:
The last function called is ~ScoreElement (defined in engraving/api/v1/scoreelement.cpp)

Supporting files, videos and screenshots

cloneclone.qml.txt

What is the latest version of MuseScore Studio where this issue is present?

master

Regression

I was unable to check

Operating system

Windows 10

Additional context

Root cause of #28648

Checklist
  • This report follows the guidelines for reporting bugs and issues
  • I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
  • I have attached all requested files and information to this report
  • I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.