GNOME Bugzilla – Bug 599232
Drag-and-drop layout: "Gdk-WARNING **: losing last reference to undestroyed window"
Last modified: 2021-07-05 10:52:56 UTC
Glom crashes when, dn developer mode, dragging an existing layout item to the bottommost position possible.
I see lots of these runtime warnings: (glom:28350): Gdk-WARNING **: losing last reference to undestroyed window (glom:28350): Gdk-CRITICAL **: gdk_window_hide: assertion `GDK_IS_WINDOW (window)' failed (glom:28350): Gdk-CRITICAL **: gdk_window_set_user_data: assertion `GDK_IS_WINDOW (window)' failed (glom:28350): Gdk-CRITICAL **: _gdk_window_destroy_hierarchy: assertion `GDK_IS_WINDOW (window)' failed sys:1: Warning: g_object_unref: assertion `G_IS_OBJECT (object)' failed And valgrind then shows: ==28350== Invalid read of size 4 ==28350== at 0x82555F2: Glom::FlowTableDnd::on_drag_data_received(Glib::RefPtr<Gdk::DragContext> const&, int, int, Gtk::SelectionData const&, unsigned int, unsigned int) (stl_vector.h:533) ==28350== by 0x4A94046: Gtk::Widget_Class::drag_data_received_callback(_GtkWidget*, _GdkDragContext*, int, int, _GtkSelectionData*, unsigned int, unsigned int) (widget.cc:5974) ==28350== by 0x4DEA268: _gtk_marshal_VOID__OBJECT_INT_INT_BOXED_UINT_UINT (gtkmarshalers.c:2233) ==28350== by 0x560C658: g_type_class_meta_marshal (gclosure.c:878) ==28350== by 0x560E102: g_closure_invoke (gclosure.c:767) ==28350== by 0x5623549: signal_emit_unlocked_R (gsignal.c:3285) ==28350== by 0x56243BF: g_signal_emit_valist (gsignal.c:2980) ==28350== by 0x5624877: g_signal_emit_by_name (gsignal.c:3074) ==28350== by 0x4F4C90A: gtk_drag_selection_received (gtkdnd.c:1767) ==28350== by 0x4DEA764: _gtk_marshal_VOID__BOXED_UINT (gtkmarshalers.c:1461) ==28350== by 0x560E102: g_closure_invoke (gclosure.c:767) ==28350== by 0x5623178: signal_emit_unlocked_R (gsignal.c:3247) ==28350== by 0x56243BF: g_signal_emit_valist (gsignal.c:2980) ==28350== by 0x5624877: g_signal_emit_by_name (gsignal.c:3074) ==28350== by 0x4E5B452: gtk_selection_retrieval_report (gtkselection.c:2940) ==28350== by 0x4E5D928: gtk_selection_convert (gtkselection.c:1089) ==28350== by 0x4F4B488: gtk_drag_get_data (gtkdnd.c:989) ==28350== by 0x4F4C70C: gtk_drag_dest_drop (gtkdnd.c:2334) ==28350== by 0x4F4ADC0: gtk_drag_find_widget (gtkdnd.c:1939) ==28350== by 0x4F4AD2D: gtk_drag_find_widget (gtkdnd.c:1924) ==28350== by 0x4F4AD2D: gtk_drag_find_widget (gtkdnd.c:1924) ==28350== by 0x4F4AD2D: gtk_drag_find_widget (gtkdnd.c:1924) ==28350== by 0x4F4AD2D: gtk_drag_find_widget (gtkdnd.c:1924) ==28350== by 0x4F4AD2D: gtk_drag_find_widget (gtkdnd.c:1924) ==28350== by 0x4F4AD2D: gtk_drag_find_widget (gtkdnd.c:1924) ==28350== by 0x4F4AD2D: gtk_drag_find_widget (gtkdnd.c:1924) ==28350== by 0x4F4AD2D: gtk_drag_find_widget (gtkdnd.c:1924) ==28350== by 0x4F4AD2D: gtk_drag_find_widget (gtkdnd.c:1924) ==28350== by 0x4F4AD2D: gtk_drag_find_widget (gtkdnd.c:1924) ==28350== by 0x4F4C39C: _gtk_drag_dest_handle_event (gtkdnd.c:1622) ==28350== Address 0x3c is not stack'd, malloc'd or (recently) free'd
Created attachment 149542 [details] backtrace.txt With some difficulty, here is the backtrace at the g_warning (break g_log) for the first "losing last reference" warning.
I fixed the crash(es). I think there was an inappropriate static_cast<> with MI: 2009-12-30 Murray Cumming <murrayc@murrayc.com> Dnd layout: Avoid a crash. * glom/utility_widgets/flowtable_dnd.cc: on_drag_data_received(): Use a dynamic_cast<> to avoid memory corruption with the MI class. Bug #599232 And there was a null dereference when there is no layout group under the drop: 2009-12-30 Murray Cumming <murrayc@murrayc.com> Dnd layout: Avoid a crash when dragging to empty space. * glom/utility_widgets/flowtable_dnd.cc: on_drag_data_received(): Avoid dereferencing a null group. Bug #599232 However, the dragged item disappears in that case: https://bugzilla.gnome.org/show_bug.cgi?id=605762 And the "lost last reference" warnings are still there, so I'm retitling this bug to work on that.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/glom/-/issues/ Thank you for your understanding and your help.