Joao Matos
e5dad52fdf
App: Invoke signalBeforeRecompute() on the GUI thread
...
Historically, `App::Document::recompute()` ran entirely on the **main**
(GUI) thread and directly emitted `signalBeforeRecompute()`.
* Add-ons like **Assembly3** and others depend on that signal for
setup/teardown hooks before any recompute work begins.
* After offloading `recompute()` into a background worker thread to keep
the UI responsive, calling `signalBeforeRecompute()` directly from the
worker would break thread-affinity rules and silently break
compatibility with those add-ons.
**Solution**
1. **Introduce a generic hook** (`PreRecomputeHook`) in
**App::Document**:
* A `std::function<void()>` that, if set, is invoked at the very
start of `recompute()`.
* Core code stays Qt-free—only knows to call a callback if one
exists.
2. **Wire up the hook in `Gui::Document`**:
* In the GUI wrapper’s constructor, install a hook that calls
`callSignalBeforeRecompute()`.
* `callSignalBeforeRecompute()` uses `QMetaObject::invokeMethod(...,
Qt::BlockingQueuedConnection)` to enqueue `signalBeforeRecompute()` on
the GUI thread and **block** the worker until it completes.
* If already on the GUI thread, it simply calls the signal directly.
3. **Maintain add-on compatibility**:
* From the add-on’s perspective nothing changes—they still receive
`signalBeforeRecompute()` on the main thread before any recompute work.
* Internally, the recompute body now runs on a worker thread,
improving UI responsiveness without breaking existing hooks.
**Result**
* **Recompute** remains fully backward-compatible for add-ons like
Assembly3.
* **UI thread** still handles all GUI-related signaling.
* **Worker thread** performs the actual heavy lifting, unblocked only
once the GUI is primed and all pre-recompute signals have been
delivered.
2025-05-19 18:30:56 +02:00
..
2025-05-19 18:30:56 +02:00
2025-01-13 21:30:30 -06:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-05-19 17:45:00 +02:00
2025-04-16 08:29:07 +02:00
2025-05-06 17:50:21 +02:00
2025-05-05 23:50:01 +02:00
2024-11-21 07:54:24 +01:00
2025-05-03 22:22:10 +02:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-04-21 15:01:03 -03:00
2025-02-17 21:10:26 +01:00
2025-02-17 21:10:26 +01:00
2025-05-12 10:39:55 -05:00
2025-03-18 15:59:22 +01:00
2025-03-20 11:07:27 +01:00
2025-04-16 20:32:04 -07:00
2025-04-29 22:50:14 -05:00
2025-05-05 23:50:01 +02:00
2025-04-14 11:20:49 -05:00
2025-05-19 18:30:56 +02:00
2025-05-19 18:30:56 +02:00
2025-04-28 10:46:52 -05:00
2025-05-06 12:02:35 -05:00
2025-05-06 12:02:35 -05:00
2025-04-22 23:52:17 +02:00
2025-01-27 16:08:18 +01:00
2024-11-21 07:54:24 +01:00
2025-03-20 11:07:27 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-03-20 11:07:27 +01:00
2024-11-21 07:54:24 +01:00
2025-04-22 23:52:17 +02:00
2025-01-27 16:08:18 +01:00
2025-04-11 14:11:33 +00:00
2025-05-05 23:50:01 +02:00
2024-11-21 07:54:24 +01:00
2025-05-05 23:50:01 +02:00
2025-05-12 10:39:55 -05:00
2025-02-24 10:23:53 -06:00
2025-04-23 17:19:32 -05:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-05-05 23:50:01 +02:00
2025-04-11 14:11:33 +00:00
2025-04-08 11:10:50 +02:00
2025-04-08 11:10:50 +02:00
2025-04-08 11:10:50 +02:00
2025-04-08 11:10:50 +02:00
2025-04-08 11:10:50 +02:00
2025-04-22 13:42:50 +02:00
2025-04-08 11:10:50 +02:00
2025-03-18 15:59:22 +01:00
2024-11-21 21:17:42 +01:00
2024-11-21 21:17:42 +01:00
2025-03-17 00:03:22 -05:00
2025-05-08 17:52:33 -05:00
2025-03-20 11:07:27 +01:00
2025-05-12 10:39:55 -05:00
2025-05-08 17:52:33 -05:00
2025-03-20 11:07:27 +01:00
2025-04-16 20:32:04 -07:00
2024-11-21 07:54:24 +01:00
2025-05-05 23:50:01 +02:00
2024-11-21 07:54:24 +01:00
2025-05-05 23:50:01 +02:00
2025-04-22 13:42:50 +02:00
2025-03-07 16:34:08 -06:00
2025-03-07 16:34:08 -06:00
2025-05-06 17:50:21 +02:00
2024-11-21 21:17:42 +01:00
2025-01-06 18:14:15 +01:00
2024-11-21 07:54:24 +01:00
2025-04-14 11:20:49 -05:00
2025-04-14 11:20:49 -05:00
2025-03-20 11:07:27 +01:00
2025-05-03 22:19:51 +02:00
2024-11-21 07:54:24 +01:00
2025-03-20 11:07:27 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-05-03 22:22:10 +02:00
2025-05-05 23:50:01 +02:00
2025-02-10 18:35:38 +01:00
2025-03-20 11:07:27 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-05-15 10:59:48 -05:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-02-21 15:04:43 +01:00
2025-05-05 23:50:01 +02:00
2024-11-21 21:17:42 +01:00
2025-03-20 11:07:27 +01:00
2025-02-08 13:14:22 +00:00
2024-11-21 21:17:42 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-03-02 16:36:40 -06:00
2025-02-17 21:10:26 +01:00
2025-03-20 11:07:27 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-02-17 21:10:26 +01:00
2025-05-05 23:50:01 +02:00
2024-11-21 07:54:24 +01:00
2025-03-20 11:07:27 +01:00
2024-11-21 07:54:24 +01:00
2025-02-18 11:07:57 -06:00
2024-11-21 07:54:24 +01:00
2025-02-10 14:33:49 -06:00
2025-04-22 13:42:50 +02:00
2025-03-20 11:07:27 +01:00
2025-02-21 15:04:43 +01:00
2025-05-07 13:34:25 +02:00
2025-05-15 10:59:48 -05:00
2024-11-26 17:36:02 +01:00
2025-01-02 13:24:57 +01:00
2025-03-22 23:27:10 +01:00
2024-11-21 07:54:24 +01:00
2025-03-20 11:07:27 +01:00
2024-11-21 07:54:24 +01:00
2025-01-27 16:08:18 +01:00
2024-11-21 07:54:24 +01:00
2025-03-20 11:07:27 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-03-29 13:32:37 +01:00
2025-04-22 13:42:50 +02:00
2025-05-09 15:54:57 +02:00
2024-11-21 07:54:24 +01:00
2025-05-06 12:00:52 -05:00
2025-05-07 15:15:08 +02:00
2025-05-12 10:39:55 -05:00
2025-04-29 22:50:14 -05:00
2025-03-20 11:07:27 +01:00
2025-04-26 14:23:25 +02:00
2025-05-12 10:39:55 -05:00
2025-02-15 13:33:32 -06:00
2025-05-12 10:39:55 -05:00
2024-11-21 21:17:42 +01:00
2025-05-09 15:54:57 +02:00
2024-11-21 21:17:42 +01:00
2025-05-12 10:39:55 -05:00
2025-05-07 13:34:25 +02:00
2025-05-12 10:39:55 -05:00
2024-11-21 21:17:42 +01:00
2025-05-12 10:39:55 -05:00
2025-02-17 21:10:26 +01:00
2025-03-31 23:50:19 +02:00
2025-03-27 21:13:21 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-01-14 09:28:47 +01:00
2025-01-04 16:32:52 +01:00
2025-05-15 10:59:48 -05:00
2024-11-21 07:54:24 +01:00
2025-03-20 11:07:27 +01:00
2025-04-16 20:32:04 -07:00
2025-03-20 11:07:27 +01:00
2025-04-16 20:32:04 -07:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-03-20 11:07:27 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2025-05-05 23:50:01 +02:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00
2024-11-21 07:54:24 +01:00