MCPcopy Create free account
hub / github.com/CppMicroServices/CppMicroServices / Uninstall

Method Uninstall

framework/src/bundle/BundlePrivate.cpp:297–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295 }
296
297 void
298 BundlePrivate::Uninstall()
299 {
300 {
301 auto l = this->Lock();
302 US_UNUSED(l);
303
304 switch (static_cast<Bundle::State>(state.load()))
305 {
306 case Bundle::STATE_UNINSTALLED:
307 throw std::logic_error("Bundle " + symbolicName + " (location=" + location
308 + ") is in BUNDLE_UNINSTALLED state");
309 case Bundle::STATE_STARTING: // Lazy start
310 case Bundle::STATE_ACTIVE:
311 case Bundle::STATE_STOPPING:
312 {
313 std::exception_ptr exception;
314 try
315 {
316 exception = (state & (Bundle::STATE_ACTIVE | Bundle::STATE_STARTING)) != 0 ? Stop0() : nullptr;
317 }
318 catch (...)
319 {
320 // Force to install
321 SetStateInstalled(false);
322 exception = std::current_exception();
323 }
324 operation = BundlePrivate::OP_UNINSTALLING;
325 if (exception != nullptr)
326 {
327 try
328 {
329 std::rethrow_exception(exception);
330 }
331 catch (...)
332 {
333 coreCtx->listeners.SendFrameworkEvent(FrameworkEvent(FrameworkEvent::Type::FRAMEWORK_ERROR,
334 MakeBundle(shared_from_this()),
335 std::string(),
336 std::current_exception()));
337 }
338 }
339 }
340 [[fallthrough]];
341 case Bundle::STATE_RESOLVED:
342 case Bundle::STATE_INSTALLED:
343 {
344 coreCtx->bundleRegistry.Remove(location, id);
345 if (operation != BundlePrivate::OP_UNINSTALLING)
346 {
347 try
348 {
349 operation = BundlePrivate::OP_UNINSTALLING;
350 }
351 catch (...)
352 {
353 // Make sure that bundleContext is invalid
354 std::shared_ptr<BundleContextPrivate> ctx;

Callers

nothing calls this directly

Calls 15

MakeBundleFunction · 0.85
nowFunction · 0.85
ExistsFunction · 0.85
RemoveDirectoryRecursiveFunction · 0.85
LockMethod · 0.80
SendFrameworkEventMethod · 0.80
SetLastModifiedMethod · 0.80
BundleEventClass · 0.70
FrameworkEventClass · 0.50
RemoveMethod · 0.45
ExchangeMethod · 0.45
InvalidateMethod · 0.45

Tested by

no test coverage detected