From 6e34450e82cd3c4184dc58f1fcec7ef17a132f2e Mon Sep 17 00:00:00 2001 From: "Mark A. Tsuchida" Date: Fri, 10 Nov 2023 16:17:44 -0600 Subject: [PATCH] Make pre-init property settability conditional Before this change: Setting a pre-init property after initialization is an error. After this change: Setting a pre-init property after initialization is an error if Core feature StrictInitializationChecks is enabled. Otherwise it is a warning. Bump MMCore version to 11.1.1. --- MMCore/Devices/DeviceInstance.cpp | 16 ++++++++++++++-- MMCore/MMCore.cpp | 2 +- MMCoreJ_wrap/pom.xml | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/MMCore/Devices/DeviceInstance.cpp b/MMCore/Devices/DeviceInstance.cpp index 2b800d8cd..a36ea75b7 100644 --- a/MMCore/Devices/DeviceInstance.cpp +++ b/MMCore/Devices/DeviceInstance.cpp @@ -180,8 +180,20 @@ void DeviceInstance::SetProperty(const std::string& name, const std::string& value) const { - if (initialized_ && GetPropertyInitStatus(name.c_str())) - ThrowError("Cannot set pre-init property after initialization"); + if (initialized_ && GetPropertyInitStatus(name.c_str())) { + // Note: Some features (port scanning) may depend on setting serial port + // properties post-init. We may want to exclude SerialManager from this + // check (regardless of whether strictInitializationChecks is enabled). + if (mm::features::flags().strictInitializationChecks) + { + ThrowError("Cannot set pre-init property after initialization"); + } + else + { + LOG_WARNING(Logger()) << "Setting of pre-init property (" << name << + ") not permitted on initialized device (this will be an error in a future version of MMCore; for now we continue with the operation anyway, even though it might not be safe)"; + } + } LOG_DEBUG(Logger()) << "Will set property \"" << name << "\" to \"" << value << "\""; diff --git a/MMCore/MMCore.cpp b/MMCore/MMCore.cpp index b458f92cf..e2c7107f6 100644 --- a/MMCore/MMCore.cpp +++ b/MMCore/MMCore.cpp @@ -102,7 +102,7 @@ using namespace std; * (Keep the 3 numbers on one line to make it easier to look at diffs when * merging/rebasing.) */ -const int MMCore_versionMajor = 11, MMCore_versionMinor = 1, MMCore_versionPatch = 0; +const int MMCore_versionMajor = 11, MMCore_versionMinor = 1, MMCore_versionPatch = 1; /////////////////////////////////////////////////////////////////////////////// diff --git a/MMCoreJ_wrap/pom.xml b/MMCoreJ_wrap/pom.xml index 38d1ba920..6be3fecd5 100644 --- a/MMCoreJ_wrap/pom.xml +++ b/MMCoreJ_wrap/pom.xml @@ -3,7 +3,7 @@ org.micro-manager.mmcorej MMCoreJ jar - 11.1.0 + 11.1.1 Micro-Manager Java Interface to MMCore Micro-Manager is open source software for control of automated/motorized microscopes. This specific packages provides the Java interface to the device abstractino layer (MMCore) that is written in C++ with a C-interface http://micro-manager.org