Page MenuHomePhabricator

Member functions might not be registered as listeners to micro service events
Closed, ResolvedPublic

Description

When severeal QmitkServiceListWidgets are listenig to the same interface events, then sometimes only one interface recieves events which should reach both. This causes inconsistent states and possibly crahes, and should be fixed for the release, since TOF, IGT and Ultrasound all rely on several instances of these widgets.

Event Timeline

Classified as Out-Of-Scope, delayed after next release.

The bug originates from deregistering an event listener without registering it prior to deregistering.

Depending on the plattform, erroneous behaviour follows. Under Windows, the Program mostly runs normal, while some ServiceEvents are dropped, especially if several instances of a QmitkServiceListWidget are listening.

Under Linux no service events ever arrive at the listener. The behaviour can easily be tested by activating openCV and the Ultrasound plugin, then uncommenting Line 74 in http://mitk.org/git/?p=MITK.git;a=blob;f=Modules/Qmitk/QmitkServiceListWidget.cpp;h=22948357df8e510eb1d49709afc3dcd671d8e6ff;hb=HEAD

When commented out, a new device can correctly be added under Linux (click "New Device", click "Done"), if not, nothing happens.

Branch published here:

bug-13003-fix-microservices-member-function-listener

Keno, when debugging the QmitkServiceListWidget I found a couple of un-initialised member variables in:

  • mitkUSImageMetadata.h (all bool variables)
  • mitkUSImageVideoSource : local variable declarations in the constructor shadow the member variable names and do not initialise them

You might also want to use a "constructor initialisation list" for correct class member variable initialisation.

[71dd75]: Merge branch 'bug-13003-fix-microservices-member-function-listener'

Merged commits:

2012-09-27 23:33:48 Sascha Zelzer [6660c5]
Fixed bug in service and module listener comparison.

This bug resulted in member functions having the same receiver
not being registered as listeners when calling
ModuleContext::RegisterServiceListener(...) or
ModuleContext::RegisterModuleListener(...). Only the first was
registered, the others compared equal to the first and were not
registered and hence not receiving events.

Tested and confirmed fixed. Thanks for the input, I'll be sure to adress the issues.