Alright, this is something that provided me trouble for some time now, so I would like to ask for help here, so here is the situation:
For my project NewCaw (A rewrite of Cawbird for GTK4) I need to implement the option to download media and display them in the UI. For downloading I am using libsoup.
Recently I rewrote the code for media download to use
GLib.Task to move the download and converting of images to a thread. While this works most time without problems, I do encounter more often than enough that libsoup segfaults or has an error which is not caught by my error handling (mostly an assertion error).
Since it worked fine with an previous approach using
async I expect that while creating the new downloader I have made some error with using
Soup, but I am not sure where it could be, which is why I want to ask here if someone else can spot the error.
The relevant classes to look at would be
MediaLoader (base class implementing the download),
ImageLoader (managing the task and creating a
MediaDisplayItem as an example for a UI class initiating a download.