You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maintaining a static ServiceTracker object can cause the program to crash on termination in ServiceTracker::Close().
The seg fault is caused by accessing the a nullptrCoreBundleContext pointer in BundleContext::GetLogSink()
test case:
#include "cppmicroservices/Framework.h"
#include "cppmicroservices/FrameworkEvent.h"
#include "cppmicroservices/FrameworkFactory.h"
#include <cppmicroservices/ServiceInterface.h>
#include "cppmicroservices/ServiceTracker.h"
#include <memory>
// A dummy interface to use with the service tracker
namespace {
class Foo {
public:
virtual ~Foo() = default;
};
}
CPPMICROSERVICES_DECLARE_SERVICE_INTERFACE(Foo, "org.cppmicroservices.test.servicetracker.Foo");
int main()
{
auto f = cppmicroservices::FrameworkFactory().NewFramework();
ASSERT_TRUE(f);
f.Start();
static std::shared_ptr<cppmicroservices::ServiceTracker<Foo>> globalTracker(std::make_shared<cppmicroservices::ServiceTracker<Foo>>(f.GetBundleContext()));
globalTracker->Open();
f.Stop();
f.WaitForStop(std::chrono::milliseconds::zero());
}
// seg fault access violation when this process destroys static objects...
Minimally ServiceTracker::Close() shouldn't crash if the Framework has been destroyed.
The text was updated successfully, but these errors were encountered:
Maintaining a static
ServiceTracker
object can cause the program to crash on termination inServiceTracker::Close()
.The seg fault is caused by accessing the a
nullptr
CoreBundleContext
pointer inBundleContext::GetLogSink()
test case:
Minimally
ServiceTracker::Close()
shouldn't crash if theFramework
has been destroyed.The text was updated successfully, but these errors were encountered: