RimGridCalculation::AdditionalCasesType::ALL_CASES and
RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN both reused the
serialization text of a sibling enum value (NONE and
INTERSECT_SHOW_BELOW respectively), so they would silently round-trip
as the wrong value when read back from a project file.
AppEnumMapperBase::addItem only asserted alias uniqueness, not text
uniqueness, so this class of bug went undetected. Add a CAF_ASSERT
checking that a new enum value's serialization text does not match an
existing value's text or aliases.
Found while investigating the AppEnum alias-duplication note in #14654.
Qt is distributed both with and without pdb files. When they are present,
copy them next to the Qt dlls so symbols are available when debugging.
Pass --pdb to windeployqt for the configurations built with debug
information, and copy the matching pdb file in the AppFwk test
applications and unit tests using a helper script that skips missing
files.
Deleting PDM objects on a worker thread is not safe. PdmObjectHandle::prepareForDelete()
mutates state owned by other objects, it nulls the guarded pointers held by other objects
and clears m_pointersReferencingMe, an unsynchronised std::set that every PdmPointer
construction and destruction touches. Destroying an object off the main thread therefore
races with the main thread on the shared object graph. See issue 14491.
Profiling a summary ensemble teardown shows the mechanism does not pay for itself. Releasing
397 Drogon realizations takes 0.24 s sequentially and 0.24 s in parallel, and for a heavy
case the parallel release is slower than the sequential one, because free() is serialised
inside the allocator. The PDM bookkeeping itself is 0.4 to 2.8 percent of the teardown.
Remove the class and deleteChildrenAsync(), and delete synchronously instead. The call sites
that used clearWithoutDelete() and a manual delete loop to work around the race can now call
deleteChildren() directly. Add caf::PdmObjectHandleTools::deleteObjects() for the case where
the objects are no longer owned by a child array field.
The observer disconnection from issue 12262 does not depend on clearWithoutDelete(). ~Signal()
unregisters itself from every observer, so a deleted child detaches itself. That fix addressed
the async race, where ~Signal() mutated the observer list from a worker thread. The unit test
is updated to assert the observed signal count directly instead of relying on a crash.
CAF_ASSERT was unconditionally active in every build configuration. Make it
follow the semantics of the standard assert(): active in Debug, compiled out in
optimized builds (NDEBUG).
Add the CMake option RESINSIGHT_ENABLE_ASSERTS_IN_RELEASE (default OFF) for
developers who want the asserts to stay active in an optimized build, which is
useful when reproducing a problem in RelWithDebInfo with a debugger attached.
When compiled out, the expression is kept inside an unevaluated sizeof rather
than discarded. It is not evaluated, so there is no run-time cost and no side
effects, but it is still type checked and any variable used only by the assert
still counts as referenced, avoiding a wave of unused-variable warnings.
CAF_ENABLE_ASSERTS is given a default in cafAssert.h so the header stays
self-contained and include order can never silently switch the asserts off.
Document in docs/agents/coding-style.md that CAF_ASSERT is the assert to use,
that CVF_ASSERT is legacy, and that asserts are for broken invariants rather
than for run-time conditions that need real error handling.
* #14411 Enforce name uniqueness for surfaces, polygons and folders
Names must be unique among siblings sharing the same parent folder. Items in different folders may keep identical names, and comparison is case sensitive.
Siblings are the objects held by the same caf::PdmChildArrayField. Items and folders live in two distinct child arrays in caf::PdmNestedCollection, so a folder and an item may share a name under the same parent.
The Python API gets an OnNameConflict flag on AddFolder, CreatePolygon, ImportSurface and NewRegularSurface, supporting FAIL (default), AUTO_RENAME and OVERWRITE. NewSurface is left out, as grid case surfaces derive their tree label from the case and K index and carry no name of their own.
Cloud services are configured from RiaApplication::initialize(), which runs before the subclasses append their logger instances. All messages from the cloud config file search were therefore dropped. Add a virtual initializeLoggers() called before the cloud configuration is read, and move creation of the file logger and the std out logger into the overrides. The message panel logger depends on the main windows, and is still created in RiaGuiApplication::initialize().
Do not write fields with IO disabled to the application store, mirroring the check already present when reading. This stops the cloud service configuration from being persisted into the user preferences file.
The tree selection editor can grow to a large height, which is useful when it is the last field editor in the property dialog. When other field editors are located below, the heightHint is now used as the maximum height instead. The form layout tracks whether an editor occupies the bottom-most row of the form and passes this to the editor. In the Analysis Plot, the time step selection is constrained to its height hint because other input fields are located below it.
The add() overloads aborted via CAF_ASSERT when passed a null field or
object, forcing every call site that adds an optional child to pre-guard.
Adding an optional node is inherently an "add it if it exists" operation,
so make both overloads a no-op on null instead: the field overload returns,
and the object overload returns nullptr. This removes a class of latent
release crashes and the need for repetitive null checks at call sites.
Also remove a redundant dynamic_cast (and its "// What ???" comment) in
containsField, since child() already returns PdmUiTreeOrdering*.
* Refactor: add MACOSX_BUNDLE option to qt_add_executable in multiple CMakeLists.txt files
* #14045 macOS: Guard std::stacktrace usage and skip ucontext on Apple platforms
* #14045 macOS: Guard std::ispanstream with std::istringstream fallback
* #14045 macOS: Add vcpkg overlay triplets for osx and exclude grpc on osx
* #14045 macOS: CMake macOS build support and openzgy OpenMP-disable patch
* #14045 CI: Add macOS build workflow
* #14045 macOS: Use feature-test macros to detect <stacktrace> and <spanstream>
* #14045 macOS: Make MAX_STIMPLAN_LAYERS constexpr to fix arm64 link error
* #14045 CI: Ship README-macOS.txt with artifact to document Gatekeeper workaround
* #14045 CI: Pin macOS runner to macos-14 and set deployment target to 14.0
* #14045 CI: Move macOS runner to macos-15 and fix README step on configure failure
IconProvider::operator= copied a new resource-string but never cleared
the existing m_pixmap. icon() prefers the pixmap when present, so a
pixmap-based default stamped earlier (e.g. by a base class) would
silently shadow a later resource-string-only assignment in a derived
class.
Reset m_pixmap in operator= so resource-string-only assignments fully
replace pixmap-based ones, and cover the replacement semantics with a
caf::IconProvider regression test: default-overwriting-pixmap,
resource-string-overwriting-pixmap and pixmap-overwriting-pixmap.
Needed for the upcoming nested-collection migration where a base class
stamps a folder pixmap and the topmost instance applies a branded
resource-string icon on top.
Introduce a shared base for tree-shaped folder containers that hold a
list of leaf items together with a list of subcontainers of the same
kind. Replaces the per-class plumbing (subcollections field, top-folder
flag, add/remove/find sub-collection, factory) that is duplicated across
RimSurfaceCollection, RimPolygonCollection and similar candidates.
- caf::PdmNestedCollectionBase: non-templated PdmObject base exposing
collection-name, add-new-subcollection, leaf-check and topmost-folder
marking for generic command features and script methods.
- caf::PdmNestedCollection<SelfT, ItemT>: CRTP template that owns the
typed m_subCollections field and inherits the m_items array from
PdmObjectCollection<ItemT>. Provides allItems(), find-sub-collection,
and a typed factory hook.
- RimNestedMirrorCollectionInView: view-side analogue for in-view
collections that mirror a nested source collection, with orphan-sweep
+ find-or-create + reorder sync.
Design rationale (templated vs non-templated, break-even on derived
class count) lives in docs/pdm-nested-collection-design.md.
No callers migrated in this commit.
Replace the class-level static_assert with a DerivedFromPdmObject concept
checked inside the constructor body. The constructor is lazily instantiated,
so T can be forward-declared at the point PdmObjectCollection<T> is used
as a base class.
Move the loops, lookups, and QString machinery out of
AppEnum<T>::EnumMapper into a new non-template AppEnumMapperBase defined
in cafAppEnum.cpp. Each member is now compiled once for the whole
program rather than once per enum type, cutting build time and binary
size for a class template instantiated across hundreds of enums.
AppEnum<T> becomes a thin static_cast shim around the base methods.
Enum values are stored as int in the mapping; a static_assert rejects
enum types whose underlying type is wider than int. The widest
underlying type currently in use in ResInsight is short, so all current
instantiations are unaffected.
Use std::optional<int> for the mapper default value, and assert against
an empty mapping in defaultValue() (the prior code returned m_mapping[0]
unconditionally, which is undefined behavior on empty).
Document why mapper() uses an explicit init flag rather than
std::call_once or a magic-static lambda: setUp() re-enters mapper() via
addItem, so anything that locks on first init would deadlock.
First-access must therefore be single-threaded, as already exercised by
BaseTest.CreateObjectInMultipleThreads.
Add AppEnumTest.MappingRoundTrip covering text <-> enum, index <-> enum,
isValid, and the failure paths of setFromText / setFromIndex (resets to
default, returns false).
* Remove unnecessary message parameter from PdmFieldScriptingCapabilityIOHandler readFromField calls
* Add checks for QFile open operations in BaseTest ReadWrite tests
* Fix integer size assertions in AppEnum and PdmLogging tests
Move pdmToVariant/pdmFromVariant overloads for cvf::Color3f, Vec3d, Mat4d, and
Mat3d from namespace caf to namespace cvf. Templates in
cafInternalPdmFieldTypeSpecializations.h use "using caf::pdmToVariant" followed
by an unqualified call, so ADL searches the argument's namespace (cvf). With the
overloads only in caf, the default template was selected, causing cvf::Color3f to
be stored raw in a QVariant instead of as QColor — breaking color field editing
and producing QVariant::save warnings.
All call sites now use the unqualified "using caf::pdmXxx; pdmXxx(value)" pattern
so ADL finds the correct overload without depending on cvf:: as a visible prefix.
Add AdlVariantTest to cafPdmCoreColor3fTest.cpp that exercises this exact pattern.
Adds caf::toVariant<T> and caf::fromVariant<T> to cafPdmFieldTraits.h as
thin wrappers that encapsulate the ADL two-step internally. Client code can
now call caf::toVariant(x) directly instead of requiring a using-declaration
at every call site.
Introduce cafPdmFieldTraits.h with ADL-based pdmToVariant/pdmFromVariant/pdmVariantEqual
as a replacement for PdmValueFieldSpecialization. Migrate all types (AppEnum, FilePath,
PdmPointer, cvf types) and all call sites (PdmDataValueField, PdmProxyValueField, UI
framework, ApplicationLibCode). Delete cafInternalPdmValueFieldSpecializations.h.
Add cafPdmFieldTraits unit tests and fix std::optional support.
Adds an OBJECT library with UNITY_BUILD OFF to measure per-file compile
cost of PDM field types in isolation. Wired into both Fwk/CMakeLists.txt
and the main CMakeLists.txt (under RESINSIGHT_INCLUDE_APPFWK_TESTS).
Also adds build-bench to .gitignore.
Remove the unused non-template PdmObjectCollection class from cafPdmObjectGroup.h/.cpp.
This class conflicted with the template caf::PdmObjectCollection<T> in cafPdmObjectCollection.h,
causing MSVC redefinition errors in Unity builds. The class was dead code with no usages
in application code.
Also correct forward declarations in test MainWindow headers from PdmObjectCollection
to PdmObjectGroup, matching actual usage in the .cpp files.
Add createDerivedObjectsRecursively() which traverses the object tree using
direct recursion and calls the virtual createDerivedObjects() on each node.
Called between the two resolveReferencesRecursively() passes in RiaApplication,
allowing objects to create child objects based on already-resolved ptr fields.
The second resolve pass then handles references in the newly created children.
Add fillWidth() to PdmUiButton to allow buttons to expand horizontally
instead of sizing to content. Make createButton protected so subclasses
can reuse button creation logic.
Remove custom editor attribute classes and migrate all double field validation and formatting (range, decimals, number format) to the attribute map system. Refactor PdmUiDoubleValueEditor to read settings from the field's attributes and always display formatted values. Remove redundant defineEditorAttribute overrides. Add tests for pair<bool, double> field validation. Centralize and simplify double field UI configuration for improved maintainability.
Added a compile-time check to call clampValue on fields that support it before setting values from the UI. This ensures values are clamped to valid limits automatically when applicable.
Enhance validation error tooltip handling by introducing a 100 ms delay before display to prevent premature dismissal from key events. Ensure tooltips are shown at the correct widget position and only when visible. Also, improve removal of error icons and support for composite editor widgets. These changes make error feedback more consistent and user-friendly.
* Add support for custom validation callbacks on fields
Introduce setCustomValidationCallback to PdmFieldHandle, allowing custom validation logic via user-provided lambdas or functions. The validate() method now invokes this callback if set, in addition to built-in checks. Includes comprehensive unit tests for custom and combined validation scenarios. Backward compatible: default behavior unchanged if no callback is set.
Removed manual setAlignment(Qt::AlignRight) calls for UI buttons,
as PdmUiButton now defaults to right alignment. Also removed
unused cafPdmUiButton.h includes from several files.
* Simplifies PdmUiFieldSpecialization implementation.
Refactors the PdmUiFieldSpecialization implementation to reduce code duplication.
Introduces a base class `PdmUiFieldSpecializationForValueSpec` that delegates to `PdmValueFieldSpecialization`, avoiding boilerplate code for common types.
The primary template now inherits from the new base class, providing default behavior for types with custom `PdmValueFieldSpecialization`.
* Improve AppEnum subset handling to avoid key collisions
Refactored AppEnum to use a unique key combining owner class name and field keyword for enum subset storage, preventing collisions when different object types use the same field keyword. Updated setEnumSubset and enumSubset to accept PdmFieldHandle pointers. Added tests to verify correct and independent subset behavior across object types and handle edge cases.
* Refactor PdmValueFieldSpecialization with base helpers
Introduce base classes for default isEqual and QVariant conversion. Update specializations to inherit from these helpers, removing redundant code and centralizing default behaviors.
Proxy fields usually reads and transforms data from other sources, usually other Pdm fields. This commit disables IO for proxy fields in the constructor. If XML serialization is required, this must be set on the proxy field, like this
field.xmlCapability()->setIOWritable(true)
field.xmlCapability()->setIOReadable(true)
Uses QWidget::addAction() to show a warning icon for validation errors, similar to the information icon for optional fields. The error message appears in the icon's tooltip, avoiding stylesheet manipulation that was causing tooltip rendering issues.
- Adds warning icon to widgets with validation errors
- Preserves field tooltips (e.g., "Valid range: ...")
- Uses QPointer for automatic null-safety
- Works with QLineEdit and other widgets
* Configures automated spell checking with codespell
Adds GitHub workflows and configuration files for automated spell checking using `codespell`.
This includes:
- A workflow for checking pull requests and preventing new typos
- A workflow for automatically fixing typos in the main codebase
- Configuration files for `codespell` to ignore specific terms and file types
- Documentation on how to use and configure the spell checking workflows.
* Corrects minor spelling and grammar errors.
Introduces `PdmUiLabel` and `PdmUiButton` classes to enable the addition of labels and buttons directly within the UI configuration, without requiring a bound PDM field.
This enhancement provides greater flexibility in constructing user interfaces and allows direct user interaction via button callbacks.
It also updates the `PdmUiOrdering` to support label and button components, and modifies the `PdmUiFormLayoutObjectEditor` to properly render these new UI elements.
Introduces the ability for labels to display hyperlinks.
This is achieved by adding a `setLabelText` function to handle both regular and shortened labels and allowing a callback function to be executed when the link is activated.
Adds a test object with labels and hyperlinks to the test application.