dlemstra / dlemstra/Magick.NET

Crash on linux if the system libglib is loaded before Magic.Net gets called

Open
#1,541 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4k
Forks
451
Avg merge
11h 55m
Merged PRs (30d)
3

Description

### Magick.NET version

Magick.NET-Q16-AnyCPU 12.1.0

### Environment (Operating system, version and so on)

.netcore 6 on ubuntu 22.04 docker container

### Description

```
(process:1): GLib-GObject-WARNING **: 03:35:20.257: cannot register existing type 'gchar'
**
GLib-GObject:ERROR:../gobject/gvaluetypes.c:455:_g_value_types_init: assertion failed: (type == G_TYPE_CHAR)
Bail out! GLib-GObject:ERROR:../gobject/gvaluetypes.c:455:_g_value_types_init: assertion failed: (type == G_TYPE_CHAR)
```

The error is similar to the following tickets:
* https://github.com/dlemstra/Magick.NET/issues/1471
* https://github.com/dlemstra/Magick.NET/issues/1126

That happens when, within the same process, the system glib is loaded before Magick.NET

Glib is built with `-Bsymbolic-functions` linker flag [https://docs.gtk.org/glib/building.html#extra-configuration-options](https://docs.gtk.org/glib/building.html#extra-configuration-options) Should Magick.Net be built with the same flag to avoid this error?

### Steps to Reproduce

`Program.cs`

```
using ImageMagick;

using var image = new MagickImage();
```

```
LD_PRELOAD=/lib/x86_64-linux-gnu/libgobject-2.0.so.0 dotnet Test.dll
```

This error happens

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.