Segmentation Fault on Try/Catch

I have an app that saves clipboard content to a database. All works well unless there is an animated gif on the clipboard, in which case an UnsupportedOperationException is thrown. If I try to catch that exception error with a try/catch statement I get a segmentation fault. Any idea why? This code:

Try rc.PictureColumn("Contents") = C.Picture Catch err As UnsupportedOperationException // Display error message End try
Results in this:

[code]Crashed Thread: 7

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000038
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0][/code]

If you put a break in the exception handler, does it hit that when you run in the debugger?

A bug report with an example project would be fantastic.

No, if the clipboard image is an animated gif the segmentation fault occurs when I attempt to write the clipboard image to a database record or save it as a file, it never gets to the exception handler. The only thing I can do with it is display it as Clipboard.Picture in a canvas. I have to check the raw data first to try to detect an animated gif before I can save the clipboard picture, otherwise it causes a segmentation fault in macOS or a runtime error in Windows. Try/Catch doesn’t work in preventing a crash in this case.

I’ll see if can come up with something within the next few days.

Do you get the segfault if you pass it through a picture object?

dim p as picture = cb.picture arc.picturecolumn("contents") = p

[quote=330021:@Greg O’Lone]Do you get the segfault if you pass it through a picture object?

dim p as picture = cb.picture arc.picturecolumn("contents") = p[/quote]
Yes, I tried that and still got a segmentation fault after the UnsupportedOperationException error, the Try/Catch statement didn’t prevent the crash. The problem seems to be specifically with the public.tiff raw data, attempting to save it to a database record or write it to a file causes a crash that the exception handler doesn’t handle.