MuseScore
MuseScore copied to clipboard
Crash after pasting a specific selection
Issue type
Crash or freeze
Bug description
Copy pasted a certain selection - program crashed
Steps to reproduce
- Store this data in your clipboard (viewed using clipboard viewer) com.trolltech.anymime.application--musescore--stafflist.txt
- Paste this in a score
- MuseScore 4 should crash (reproduced using both my own native compiled version and official release)
Screenshots/Screen recordings
MuseScore Version
4.2.1 (lastest)
Regression
I don't know
Operating system
macOS 12
Additional context
I copied from a selection in a project I was working on. Let me know if you want the project. Unfortunately I don't have that project saved when musescore crashes so I'm not sure if it still contained content that can trigger this bug.
@sclsj Please add more details to repro steps. What should be copied/pasted from this long txt file?
https://github.com/musescore/MuseScore/assets/90187801/b6bec2e5-af1a-4ef5-b1fd-cdc96517ee2c
This should be written to the clipboard (pasteboard) under the key com.trolltech.anymime.application--musescore--stafflist
.
This is essentially what gets written to the pasteboard when a section of music is copied in MuseScore. Unfortunately I don't program in macOS so I don't know how you would write this exported file into the pasteboard. I just searched online how I can export pasteboard that is custom application data and found this sample XCode project provided by Apple that can do this.
So, to answer your question: I don't know how. But since MuseScore writes this to the pasteboard in the first place, I'm sure someone knows how.
Try this solution by GPT-4. It works on my machine. https://chat.openai.com/share/af60cb29-1d38-4feb-a95d-23af5fa12809
TL;DR: compile this swift snippet swiftc -o copyToClipboard copyToClipboard.swift
, and run it on the downloaded com.trolltech.anymime.application--musescore--stafflist.txt
file:
import Cocoa
let filePath = CommandLine.arguments[1]
let customMimeType = "com.trolltech.anymime.application--musescore--stafflist"
let pasteboard = NSPasteboard.general
do {
let fileContent = try String(contentsOfFile: filePath)
pasteboard.declareTypes([NSPasteboard.PasteboardType(rawValue: customMimeType)], owner: nil)
pasteboard.setString(fileContent, forType: NSPasteboard.PasteboardType(rawValue: customMimeType))
} catch {
print("Failed to read the file or copy to clipboard: \(error)")
}
Closing as stale