Sign up

"g_object_remove_toggle_ref" warnings

Hi,

I'm using gtkd 3.8.4 and I'm getting warnings like this:

(fviewer:6538): GLib-GObject-WARNING **: 18:02:01.422: g_object_remove_toggle_ref: couldn't find toggle ref 0x564cfec5ebb8(0x7f755db58240)

I've traced my app and all of them happen when reading the widgets of the GUI from the ui-file via GtkBuilder, more precisely they occur inside the call to opCast from getObject for each widget, i.e.:

private void createUI () {
  theBuilder = new Builder();

  if(!theBuilder.addFromFile(buildPath(pkguidir,"fviewer-b.ui")))
  {
    critical("Window ui-file cannot be found");
    return;
  }

  HeaderBar headerBar = cast(HeaderBar) theBuilder.getObject("wHeaderBar"); // Produces the warning
  Box wContent = cast(Box) theBuilder.getObject("wContent");  // Also warning here
  ....

In spite of the warnings the application works ok.

Any ideas about what I'm doing wrong or how could I prevent these warnings?
Thanks!

Re: "g_object_remove_toggle_ref" warnings

On 18-12-2018 18:14, Antonio Corbi wrote:

Hi,

I'm using gtkd 3.8.4 and I'm getting warnings like this:

(fviewer:6538): GLib-GObject-WARNING **: 18:02:01.422: g_object_remove_toggle_ref: couldn't find toggle ref 0x564cfec5ebb8(0x7f755db58240)

I've traced my app and all of them happen when reading the widgets of the GUI from the ui-file via GtkBuilder, more precisely they occur inside the call to opCast from getObject for each widget, i.e.:

 private void createUI () {
   theBuilder = new Builder();

   if(!theBuilder.addFromFile(buildPath(pkguidir,"fviewer-b.ui")))
   {
     critical("Window ui-file cannot be found");
     return;
   }

   HeaderBar headerBar = cast(HeaderBar) theBuilder.getObject("wHeaderBar"); // Produces the warning
   Box wContent = cast(Box) theBuilder.getObject("wContent");  // Also warning here
   ....

In spite of the warnings the application works ok.

Any ideas about what I'm doing wrong or how could I prevent these warnings?
Thanks!

The destructor tried to remove the toggleRef that was already removed by
the opCast. While your application keeps working this could be a memory
leak.

Should be fixed in:
https://github.com/gtkd-developers/GtkD/commit/b38f70c6f02b8efc8107f7939b3336644267aa9c

Re: "g_object_remove_toggle_ref" warnings

On Tue, 18 Dec 2018 20:27:58 +0100, Mike Wey wrote:

The destructor tried to remove the toggleRef that was already removed by
the opCast. While your application keeps working this could be a memory
leak.

Should be fixed in:
https://github.com/gtkd-developers/GtkD/commit/b38f70c6f02b8efc8107f7939b3336644267aa9c

Thanks Mike!

Antonio