Skip to content

Avoid crashing when clicking reload#2283

Open
abdelq wants to merge 1 commit intoKLayout:masterfrom
abdelq:crash-on-reload
Open

Avoid crashing when clicking reload#2283
abdelq wants to merge 1 commit intoKLayout:masterfrom
abdelq:crash-on-reload

Conversation

@abdelq
Copy link

@abdelq abdelq commented Feb 24, 2026

For context, this was happening to me on macOS with files being written to a temporary directory and no longer existing there. I would attempt to reload with the notification and KLayout would crash instead of giving an error message.

@klayoutmatthias
Copy link
Collaborator

Hi @abdelq,

thanks for the PR, but I think it's not the right place to catch exceptions. "reload layout" is part of the script API and it should really throw an exception in case of an error.

I tried to reproduce the problem on Linux, and there is no crash as the exception is caught higher up in the call stack - namely in lay::GuiApplication::do_notify:

image

So there is a no systematic issue. When you see a crash on MacOS it's likely because there may be an ABI incompatibility between the Qt shared objects and the application code and that prevents throwing exceptions over Qt library boundaries. I had such cases, when the Qt library is built with a different compiler than the application.

This is a general issue and will cause problems in many other places.

If the is absolutely no other solution, you can basically put the BEGIN_PROTECTED ... END_PROTECTED bracket into lay::LayoutViewNotificationWidget::action_triggered (once is enough), but I think this will only solve one problem out of many.

Matthias

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

Successfully merging this pull request may close these issues.

2 participants