Skip to content

Crash when creating MagickImage in a project using GtkSharp on Linux #1126

Open
@katrina-krings

Description

@katrina-krings

Description

This issue affects Linux specifically, Windows is not impacted.

This issue also is in regard to working with another library with C/C++ bindings, GtkSharp. I opened the issue in this repository, as I believe the problem is more likely in Magick.NET than in GtkSharp, as all GtkSharp objects create fine.

In a project utilizing GtkSharp (the modern one, not mono's), creating a MagickImage (from a file or even an empty one) will result in a warning by GLib-GObject and then kill the program after an assertion fails later.

Steps to Reproduce

Create a .NET 6 console project, and add packages Magick.NET-Q8-AnyCPU and GtkSharp (versions used below)
Place the following in Program.cs, and then dotnet run

using System;
using Gtk;
using ImageMagick;

namespace Test{

	class Program{
		[STAThread]
		public static void Main(string[] args){
			Application.Init();
			var app = new Application("org.Test.Test", GLib.ApplicationFlags.None);
			app.Register(GLib.Cancellable.Current);

			var win = new Test();
			app.AddWindow(win);

			win.Show();
			Application.Run();
		}
	}

	class Test : Window{
		public Test() : base("Test Window"){
			new MagickImage();
			ShowAll();
		}
	}
}

The following error will be produced, and then the application will die

(test:120621): GLib-GObject-WARNING **: 09:50:52.201: 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)

System Configuration

  • Magick.NET version: Magick.NET-Q8-AnyCPU 9.1.1
  • Environment (Operating system, version and so on): Arch Linux, Kernel 5.16.7, .NET 6.0.100, X11
  • Additional information: GtkSharp 3.24.24.34, ImageMagick 7.1.0.23-1
    Functions on Windows 10 when running the exact same code/project

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions