| 1163 | } // Node::disconnectInput |
| 1164 | |
| 1165 | int |
| 1166 | Node::disconnectInputInternal(Node* input, bool useGuiValues) |
| 1167 | { |
| 1168 | assert(_imp->inputsInitialized); |
| 1169 | assert(input); |
| 1170 | if (!input) { |
| 1171 | throw std::logic_error(__func__); |
| 1172 | } |
| 1173 | int found = -1; |
| 1174 | NodePtr inputShared; |
| 1175 | { |
| 1176 | QMutexLocker l(&_imp->inputsMutex); |
| 1177 | if (!useGuiValues) { |
| 1178 | for (std::size_t i = 0; i < _imp->inputs.size(); ++i) { |
| 1179 | NodePtr curInput = _imp->inputs[i].lock(); |
| 1180 | if (curInput.get() == input) { |
| 1181 | inputShared = curInput; |
| 1182 | found = (int)i; |
| 1183 | break; |
| 1184 | } |
| 1185 | } |
| 1186 | } else { |
| 1187 | for (std::size_t i = 0; i < _imp->guiInputs.size(); ++i) { |
| 1188 | NodePtr curInput = _imp->guiInputs[i].lock(); |
| 1189 | if (curInput.get() == input) { |
| 1190 | inputShared = curInput; |
| 1191 | found = (int)i; |
| 1192 | break; |
| 1193 | } |
| 1194 | } |
| 1195 | } |
| 1196 | } |
| 1197 | if (found != -1) { |
| 1198 | { |
| 1199 | QMutexLocker l(&_imp->inputsMutex); |
| 1200 | if (!useGuiValues) { |
| 1201 | _imp->inputs[found].reset(); |
| 1202 | _imp->guiInputs[found].reset(); |
| 1203 | } else { |
| 1204 | _imp->guiInputs[found].reset(); |
| 1205 | } |
| 1206 | } |
| 1207 | input->disconnectOutput(useGuiValues, this); |
| 1208 | Q_EMIT inputChanged(found); |
| 1209 | bool mustCallEnd = false; |
| 1210 | if (!useGuiValues) { |
| 1211 | beginInputEdition(); |
| 1212 | mustCallEnd = true; |
| 1213 | onInputChanged(found); |
| 1214 | } |
| 1215 | bool creatingNodeTree = getApp()->isCreatingNodeTree(); |
| 1216 | if (!creatingNodeTree) { |
| 1217 | ///Recompute the hash |
| 1218 | if ( !getApp()->getProject()->isProjectClosing() ) { |
| 1219 | computeHash(); |
| 1220 | } |
| 1221 | } |
| 1222 |
no test coverage detected