Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access Violation When Renaming A Component #543

Open
antitu opened this issue Oct 21, 2023 · 7 comments
Open

Access Violation When Renaming A Component #543

antitu opened this issue Oct 21, 2023 · 7 comments

Comments

@antitu
Copy link

antitu commented Oct 21, 2023

When renaming a component in the Hierarchy list, clicking away from the rename field will generate an Access Violation. The console output shows:
(castle-editor:13893): GLib-GObject-CRITICAL **: 00:09:17.444: ../glib/gobject/gsignal.c:1285: no emission of signal "button-release-event" to stop for instance '0x6b349b0'

System Details:
OS - Manjaro x64
Kernel - 6.4.6-3-rt8

Steps to reproduce:

  1. In the Castle Editor, click on a component, then click again to rename it.
  2. Click on another component in the list.
  3. An Access Violation window will appear.

Screenshots

Renaming A Component
image

Access Violation
image

@michaliskambi
Copy link
Member

Thank for you for reporting!

Quick investigation now shows the crash is somewhere deep inside GTK2 widgetset implementation in LCL. I wasn't able to pinpoint it better now. Lazarus debugger doesn't show anything useful (goes to assembler view), VS Code debugger shows that GTK2 routine g_type_check_instance_is_a got invalid pointer, maybe because something higher-up got nil pointer:

obraz

When CGE editor is recompiled to use Qt5 widgetset on Linux, everything works OK.

I've been wondering about switching CGE editor widgetset to Qt5 already, as we already had some crashes in GTK2 with ugly workarounds (but at least the previous ones had a workaround).

The main downside of using Qt5 will be that users need to install libqt5pas library (on Debian or Ubuntu: libqt5pas1 package), which probably most users don't have. The upside is that we completely avoid GTK2-specifc bugs, and we avoid using deprecated GTK2 for editor... See also recent talk about CGE on Debian mailing list, my message: https://alioth-lists.debian.net/pipermail/pkg-pascal-devel/Week-of-Mon-20230925/004933.html .

I'll see how to deal with this:

  • Maybe this is another argument to switch CGE editor to Qt5 widgetset. This is a critical bug, it is better to require libqt5pas dependency than to have a crash in the middle of editing.

  • We definitely should fix or workaround GTK2 bug, even if GTK2 will not be the default widgetset. Or we will have to say "GTK2 widgetset is uinsupported" and block compiling CGE editor with it. (As we do with GTK3 widgetset now, which is very unstable.)

@bbrtj
Copy link

bbrtj commented Oct 30, 2023

This was getting increasingly annoying lately so I'm happy it's as simple as compiling with qt5. I was a bit wary at first because of #391, but it seems it's all good and fixed now. It also resolves my other problem from #426. Seems like a single dependency is not too high of a price for all these issues resolved, but it's good to have an alternative as well just in case.

@michaliskambi
Copy link
Member

I'm talking with Jenkins now to provide automatic build of CGE editor with Qt5 widgetset in our official downloads on https://castle-engine.io/download . For start, we'll have castle-editor-qt5 binary alongside (GTK 2) castle-editor.

The old issue #391 should no longer pose any problem, as my fix https://gitlab.com/freepascal.org/lazarus/lazarus/-/merge_requests/95 was merged to Lazarus and it's available since Lazarus 2.2.4 onward. @bbrtj Though I see your #546 -- I'll investigate it soon, thank you for testing qt5 version!

@michaliskambi
Copy link
Member

FYI, I retested this issue with latest FPC + Lazarus from the GitLab main branches, hoping for improvements ( @and3md mentioned that there were some GTK2 fixes). Alas, the bug is still there (with GTK2 widgetset, that is).

@and3md
Copy link
Contributor

and3md commented Nov 10, 2023

I tried to reproduce this on Linux Mint 21.1 Cinnamon using fpc/lazarus fixes branch and master. But it looks like it works without any problems for me (maybe I'm lucky one but never had this error). Maybe it depends on the graphical environment?

To be precise, I also have these warnings (no emission of signal "button-release-event" ) in the console.

@michaliskambi
Copy link
Member

Notes about things done/tested around this:

@michaliskambi
Copy link
Member

We are going forward with testing Qt5 version of the editor. CGE binaries include castle-editor-qt5 alongside castle-editor now since some time.

Unfortunately today I had to disable building castle-editor-qt5 -- because Lazarus 3.2 Qt5 bindings are not compatible with libqt5pas present in latest Ubuntu stable ( see https://forum.lazarus.freepascal.org/index.php/topic,65619.msg500216.html#msg500216 and also note about it on https://github.com/gcarreno/setup-lazarus?tab=readme-ov-file ). We could update libqt5pas in our Docker image, but the resulting binary would crash on users' systems (if they don't have updated libqt5pas). Unfortunately, this issue (need to have right version of libqt5pas in order to make binaries compiled with Qt5 backend work) makes the LCL Qt5 binding problematic.

At this point I think Snap or Flatpak, as mentioned above, are the only hope to distribute binaries compiled with LCL Qt5 backend reasonably (so that users are not surprised with crashes).

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

No branches or pull requests

4 participants