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:
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.
[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.