Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Duplicate object warning when creating GtkCssProvider objects #526

Open
nlw0 opened this issue Sep 21, 2020 · 2 comments
Open

Duplicate object warning when creating GtkCssProvider objects #526

nlw0 opened this issue Sep 21, 2020 · 2 comments

Comments

@nlw0
Copy link
Contributor

nlw0 commented Sep 21, 2020

Creating more than one GtkCssProvider object throws a "duplicate Julia object creation detected for GObject" warning message. While this doesn't seem to be a problem, it might indicate a potential issue. Plus it's nagging.

julia> using Gtk

julia> css = GtkCssProvider(data = "#thing {color: #fafef1}")
GtkCssProviderLeaf()

julia> css = GtkCssProvider(data = "#thing {color: #fafef1}")
┌ Warning: Duplicate Julia object creation detected for GObject
└ @ Gtk.GLib ~/.julia/packages/Gtk/C22jV/src/GLib/gtype.jl:468
GtkCssProviderLeaf()

julia> css = GtkCssProvider(data = "#thing {color: #fafef1}")
┌ Warning: Duplicate Julia object creation detected for GObject
└ @ Gtk.GLib ~/.julia/packages/Gtk/C22jV/src/GLib/gtype.jl:468
GtkCssProviderLeaf()

julia>

@jonathanBieler
Copy link
Collaborator

I think it's because the GtkCssProvider constructor is calling gtk_css_provider_get_default so you end up having several objects "pointing" to the default provider.

Apparently gtk_css_provider_get_default is deprecated and we should use gtk_css_provider_new instead :

https://developer.gnome.org/gtk3/stable/GtkCssProvider.html#gtk-css-provider-get-default

@tknopp
Copy link
Collaborator

tknopp commented Oct 1, 2020

To my defense, at the time I implemented the GtkCssProvider the function was not yet deprecated ;-). PR welcome

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants