adobe / adobe/XMP-Toolkit-SDK

Photoshop on MAC: "Export->Save for Web(Legacy)" crashes when a Plugin with XMP-Toolkit is installed

Open
#84 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
262
Forks
110
PR merge metrics
No merged PRs in 30d

Description

I have a plugin which is using the XMP-Toolkit-SDK. I found out that if this plugin is installed, Photoshop crashes when trying to save an image via "File -> Export -> Save for Web(Legacy).
All other Saving/Exporting functions in Photoshop seems fine so far.

Attached is the crash-report given by Apple
[CrashReport.txt](https://github.com/adobe/XMP-Toolkit-SDK/files/13685872/CrashReport.txt)

As it can be seen here, the XMP-Toolkit is directly called from "Save for Web", so I have no chance to put something into my code to avoid writing Metadata in that case.

```
0 libsystem_pthread.dylib 0x7ff80aa6e4ac pthread_mutex_lock + 4
1 libGMGSharedPsPlugin.dylib 0x14d3b4782 XMP_HomeGrownLock::AcquireForWrite() + 18
2 libGMGSharedPsPlugin.dylib 0x14d3b5286 XMP_NamespaceTable::Define(char const*, char const*, char const**, unsigned int*) + 70
3 libGMGSharedPsPlugin.dylib 0x14d37022f XMPMeta::RegisterNamespace(char const*, char const*, char const**, unsigned int*) + 47
4 libGMGSharedPsPlugin.dylib 0x14d416794 0x14d2a3000 + 1521556
5 libGMGSharedPsPlugin.dylib 0x14d414abb 0x14d2a3000 + 1514171
6 libGMGSharedPsPlugin.dylib 0x14d412ed3 0x14d2a3000 + 1507027
7 libGMGSharedPsPlugin.dylib 0x14d4105d7 0x14d2a3000 + 1496535
8 libGMGSharedPsPlugin.dylib 0x14d40f01a 0x14d2a3000 + 1490970
9 libGMGSharedPsPlugin.dylib 0x14d40b911 0x14d2a3000 + 1476881
10 libGMGSharedPsPlugin.dylib 0x14d40b17b XML_ParseBuffer + 171
11 libGMGSharedPsPlugin.dylib 0x14d3a7171 ExpatAdapter::ParseBuffer(void const*, unsigned long, bool) + 65
12 libGMGSharedPsPlugin.dylib 0x14d36abdd 0x14d2a3000 + 818141
13 libGMGSharedPsPlugin.dylib 0x14d36a853 XMPMeta::ProcessXMLBuffer(char const*, unsigned int, bool) + 867
14 libGMGSharedPsPlugin.dylib 0x14d36ae98 XMPMeta::ParseFromBuffer(char const*, unsigned int, unsigned int) + 136
15 libGMGSharedPsPlugin.dylib 0x14d35f461 WXMPMeta_ParseFromBuffer_1 + 81
16 libGMGSharedPsPlugin.dylib 0x14d2e85f1 TXMPMeta, std::__1::allocator>>::TXMPMeta(char const*, unsigned int) + 113
17 Save for Web 0x1f9d39dd3 S4WTargetGenerationContext::MakeMetadataImageResources(std::__1::basic_string, std::__1::allocator> const&, MetadataOutputSettings const&) + 159
```

I find it somehow strange that crash happens even if I do not call any part of the XMP-Toolkit actively, it needs to be just there in the code.

Example:
I have the following call:
.h-File:

```
#if defined(Q_OS_MAC)
#ifndef MAC_ENV
#define MAC_ENV
#endif
#else
#ifndef WIN_ENV
#define WIN_ENV
#endif
#endif

#define TXMP_STRING_TYPE std::string
#include
class GMGSHAREDPSPLUGINSHARED_EXPORT XmpManager
{
public:
XmpManager();
~XmpManager();
private:
std::unique_ptr _xmpData;
};
```

.cpp-File:
```
XmpManager::XmpManager()
{
_xmpData = std::unique_ptr (new SXMPMeta());
}

XmpManager::~XmpManager()
{
_xmpData.reset();
}
```
This code will lead to the crash, **even if I do not call the constructor at all**. When I comment out `_xmpData = std::unique_ptr (new SXMPMeta());`, it is fine.
This seems to me like a very strange behaviour.

#### Platform and Version

MAC-OS: Tested with 14.2 and 13.6 on both Intel and Arm, all are reproducable
Photoshop-Version: Tested with 22, 23 and 24, all reproducable
Toolkit-Version: February 2022 has the problem, older Version of my Plugin which use a version from 2014 does not crash

Windows: Working fine
Illustrator on Mac: Working fine

Contributor guide

Open the contributing guide

Research direction

Read the attached CrashReport.txt and the XMP.hpp/SXMPMeta usage shown in the issue; reproduce the macOS Save for Web (Legacy) crash with the February 2022 toolkit. Done means the plugin can use SXMPMeta without crashing that export path, while the reported Windows and Illustrator behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, macos
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.