Fix GTK4 GMenuItem stale handle reuse causing GLib-GIO-CRITICAL warnings#90
Fix GTK4 GMenuItem stale handle reuse causing GLib-GIO-CRITICAL warnings#90
Conversation
Co-authored-by: akurtakov <574788+akurtakov@users.noreply.github.com>
… CASCADE items Co-authored-by: akurtakov <574788+akurtakov@users.noreply.github.com>
…l else logic Co-authored-by: akurtakov <574788+akurtakov@users.noreply.github.com>
…ication Co-authored-by: akurtakov <574788+akurtakov@users.noreply.github.com>
Co-authored-by: akurtakov <574788+akurtakov@users.noreply.github.com>
|
@copilot There are many errors at runtime that appear with this PR: |
…'t unref The previous implementation incorrectly called g_object_unref on the old handle, causing widget registry corruption. In GTK4, GMenuItem is a transfer object - when inserted into a GMenu, ownership is transferred and the menu manages the lifecycle. Manually unreffing causes double-free errors. The fix: - Deregister old handle from widget table before creating new one - Register new handle in widget table after creation - Do NOT unref old handle (menu owns it after insertion) This prevents the "g_object_get_qdata returned unexpected index value" errors. Co-authored-by: akurtakov <574788+akurtakov@users.noreply.github.com>
... Fixed in commit 5fbfcc5. The issue was incorrect handle lifecycle management - I was calling Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot New error is !ENTRY org.eclipse.ui 4 0 2026-02-14 19:50:14.483 |
During widget disposal, the display field can be null when recreateGMenuItemHandle is called on items being moved between sections. This happens when a separator is destroyed and its items are being moved to the section above. Added null checks before accessing display.removeWidget() and display.addWidget() to prevent NullPointerException during disposal sequence. Co-authored-by: akurtakov <574788+akurtakov@users.noreply.github.com>
Fixed in commit 4ccad29. The issue occurred when items are moved between sections during separator disposal - the display field can be null at that point. Added null checks before accessing display.removeWidget() and display.addWidget(). Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
45fdafa to
e1f8208
Compare
8788199 to
76095b4
Compare
e005bf8 to
e77c3cf
Compare
Fix GTK4 GMenuItem stale handle reuse causing GLib-GIO-CRITICAL warnings
Plan
recreateGMenuItemHandle()to recreate GMenuItem handles with current propertiessetText()method (lines ~1279-1280) - recreate handle before reinsertionsetMenu()method (lines ~1144-1145) - recreate handle before reinsertioncreateHandle()separator handling (lines ~320-326) - recreate handles when moving itemsdestroyWidget()separator destruction (lines ~764-766) - recreate handles when moving itemsRuntime Error Fixes
g_object_get_qdataerrors (commit 5fbfcc5): Removed incorrectg_object_unrefcall and properly deregister/register handles in widget tableSecurity Summary
No security vulnerabilities detected. Changes follow safe memory management practices with proper widget table registration/deregistration and null safety.
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.