powertab / powertabeditor

View and edit guitar tablature.
https://powertab.github.io
GNU General Public License v3.0
518 stars 68 forks source link

Segmentation fault when opening .gpx file #442

Closed sanderploegsma closed 12 months ago

sanderploegsma commented 1 year ago

Description I ran into a segmentation fault when opening this .gpx file.

To Reproduce Try to open the linked .gpx file. The error occurs immediately.

Additional Info

Stack trace

``` Segmentation fault 0# main in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor 1# main in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor 2# _sigtramp in /usr/lib/system/libsystem_platform.dylib 3# Gp7::convert(Gp7::Document const&, Score&) in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor 4# Gp7::convert(Gp7::Document const&, Score&) in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor 5# Gp7::convert(Gp7::Document const&, Score&) in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor 6# Gp7::convert(Gp7::Document const&, Score&) in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor 7# GpxImporter::load(std::__1::__fs::filesystem::path const&, Score&) in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor 8# FileFormatManager::importFile(Score&, std::__1::__fs::filesystem::path const&, FileFormat const&) in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor 9# PowerTabEditor::openFile(QString) in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor 10# PowerTabEditor::openFiles(QStringList const&) in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor 11# boost::stacktrace::detail::unwind_callback(_Unwind_Context*, void*) in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor 12# QApplicationPrivate::notify_helper(QObject*, QEvent*) in /Applications/Power Tab Editor.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets 13# QApplication::notify(QObject*, QEvent*) in /Applications/Power Tab Editor.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets 14# QCoreApplication::notifyInternal2(QObject*, QEvent*) in /Applications/Power Tab Editor.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore 15# QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) in /Applications/Power Tab Editor.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui 16# QWindowSystemInterface::handleFileOpenEvent(QString const&) in /Applications/Power Tab Editor.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui 17# qt_plugin_instance in /Applications/Power Tab Editor.app/Contents/PlugIns/platforms/libqcocoa.dylib 18# withWindowOrderingObserverHeuristic in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 19# -[NSApplication(NSAppleEventHandling) _openURLs:withCompletionHandler:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 20# __69-[NSApplication(NSAppleEventHandling) _handleAEOpenDocumentsForURLs:]_block_invoke in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 21# __72-[NSPersistentUIManager restoreAllPersistentStateWithCompletionHandler:]_block_invoke in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 22# __90-[NSDocumentController(NSInternal) _autoreopenDocumentsFromRecords:withCompletionHandler:]_block_invoke in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 23# -[NSDocumentController(NSInternal) _autoreopenDocumentsFromRecords:withCompletionHandler:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 24# __97-[NSDocumentController(NSInternal) _autoreopenDocumentsIgnoringExpendable:withCompletionHandler:]_block_invoke_3 in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 25# -[NSDocumentController(NSInternal) _autoreopenDocumentsIgnoringExpendable:withCompletionHandler:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 26# -[NSPersistentUIRestorer finishedRestoringWindowsWithZOrder:completionHandler:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 27# -[NSPersistentUIRestorer restoreStateFromRecords:usingDelegate:requireSecureCoding:completionHandler:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 28# -[NSPersistentUIManager restoreAllPersistentStateWithCompletionHandler:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 29# -[NSApplication _reopenWindowsAsNecessaryIncludingRestorableState:completionHandler:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 30# -[NSApplication(NSAppleEventHandling) _handleAEOpenDocumentsForURLs:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 31# -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 32# -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation 33# _NSAppleEventManagerGenericHandler in /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation 34# _AppleEventsCheckInAppWithBlock in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE 35# _AppleEventsCheckInAppWithBlock in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE 36# aeProcessAppleEvent in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE 37# AEProcessAppleEvent in /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox 38# _DPSNextEvent in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 39# -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 40# -[NSApplication run] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit 41# qt_plugin_instance in /Applications/Power Tab Editor.app/Contents/PlugIns/platforms/libqcocoa.dylib 42# QEventLoop::exec(QFlags) in /Applications/Power Tab Editor.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore 43# QCoreApplication::exec() in /Applications/Power Tab Editor.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore 44# main in /Applications/Power Tab Editor.app/Contents/MacOS/Power Tab Editor ```

Version Power Tab Editor version v2.0.0-alpha19-0-g48acb0b MacOS version 13.4 (Apple Silicon)

cameronwhite commented 1 year ago

Thanks for the report! From a quick investigation it looks like the XML format for chord diagrams is different than what the code expects. It might be an older format from previous GP6 versions - exporting a new .gpx file from GP8 seems to use the expected format

Snippet from the expanded xml:

<Property name="DiagramCollection">
    <Items>
        <Item id="0" name="D7add13">
            <Diagram stringCount="6" fretCount="5" />
        </Item>

The re-exported version (expected format):

<Item id="0" name="D7add13">
    <Diagram stringCount="6" fretCount="5" />
    <Chord>
        <KeyNote step="C" accidental="Natural" />
        <BassNote step="C" accidental="Natural" />
    </Chord>
</Item>

With the old format missing the Chord information, the chord name ends up triggering errors later from having unexpected contents

cameronwhite commented 12 months ago

The crash is fixed now with the latest commits - chord names can also now specify a custom label rather than the auto-generated chord name, which is more compatible with Guitar Pro