Photoshop CC 2018/2019: Background save instability on Windows

  • 1
  • Problem
  • Updated 1 week ago
  • (Edited)
I'm cross-posting this from forums.adobe.com as I haven't yet had a response there and only just learned of this feedback forum. (https://forums.adobe.com/thread/2567737)

We are developing the next version of our file format plugin and an associated CEP extension for Photoshop. When the user hits "OK" on the Save As dialog with our format selected, we want a UI to pop up similar to how a UI pops up for JPEGs. We also want the UI to look like and respond to the theming of Photoshop, thus the usage of CEP. To implement this we are loading our CEP extension via PlugPlug in the OptionsStart call. Then, on the WriteStart, which is on a background thread, we block until we receive an event from the CEP UI indicating that the user either hit OK or Cancel, or closed the dialog. If the user cancels, we return *result = userCanceledErr from WriteStart.

 

The problem is that we are experiencing "Could not save file ... because of a program error" errors as well as crashes (heap corruption, access violation, invalid handle, etc, always in Photoshop code) maybe 1 out of 5 saves. After paring down our code until it was a noop (the only thing we were doing was setting *result = userCanceledErr in WriteStart) we still experienced crashes. Sometimes the crashes would occur before WriteStart was even called.

 

I then took the SimpleFormat example and stripped it down to the same noop and it was stable. Then, I set SupportsBackgroundSave in the PIPL, and blew away my Preferences. With SupportsBackgroundSave enabled, the SimpleFormat example also crashes.

 

I am compiling with Visual Studio 2015 14.0.25420.1 Update 3 and have also tried Visual Studio 2017 15.6.2. We are targetting 64 bit. The compiler version doesn't seem to make a difference. We are also developing for Mac but have only seen this instability on Windows.

 

We are also now aware that unfortunately background save is not a guarantee as the user can disable it in preferences. We are assuming most people aren't going to touch this setting, and in that case we plan on informing them they must enable background saving to save to our file format. As far as we can tell, there would be no way to integrate our workflow using CEP without having the background save thread.

 

The documentation says "Formats that rely on Globals, Mac resource manager, or show UI after the formatSelectorWriteStart entry should not allow background save." We have an example of a noop that crashes Photoshop. Is there anything special we need to do to support background save, or is this a bug in Photoshop? CC 2017 does not exhibit this behavior, nor does the Mac version of Photoshop.

 

Example output:

trace:PluginMain selector is 5

trace:PluginMain selector is 6

trace:PluginMain selector is 8

trace:PluginMain selector is 9

trace:PluginMain selector is 10

trace:PluginMain selector is 12

Unhandled exception at 0x00007ff96a334d7b in Photoshop.exe: 0xC0000374: A heap has been corrupted.
Photo of Jason Overland

Jason Overland

  • 3 Posts
  • 0 Reply Likes

Posted 2 weeks ago

  • 1
Photo of Sam Ostrow

Sam Ostrow

  • 19 Posts
  • 3 Reply Likes
It might help if those reading this knew what plug-in you're writing about! I probably can't help, but I can't even start with the little you have provided.

Photo of Jason Overland

Jason Overland

  • 3 Posts
  • 0 Reply Likes
Sorry for not being clear. We're in the process of developing a plugin, and my question is really more about the Adobe Photoshop SDK for developing File Format plugins than a specific plugin.
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14678 Posts
  • 1958 Reply Likes
Hi Jason, I might need to connect you directly with Tom who's our plug-in partner contact on the engineering side.
Photo of Jason Overland

Jason Overland

  • 3 Posts
  • 0 Reply Likes
OK. Is that something we'd do over email, or is there a way to direct message here?
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14678 Posts
  • 1958 Reply Likes
I'll email you.