We've been upgrading our module to the latest Salome version (9.12.0) and this issue came up.
Basically, the destructor of QtxDockWidget is creating a segfault if the QtxDockWidget hasn't instantiated a Watcher, so when you use the two constructor that don't.
Two constructors of QtxDockWidget just initialize the Watcher object to 0,
this one
I'm guessing setParent is derenferencing the implicit this pointer at some point, which would explain the segfault.
Expectedly, it works fine if we use the constructor that instantiates a Watcher object.
QtxDockWidget::QtxDockWidget( const bool watch, QWidget* parent, Qt::WindowFlags f )
: QDockWidget( parent, f ),
myWatcher( 0 ),
myOrientation( (Qt::Orientation)-1 )
{
if ( watch )
myWatcher = new Watcher( this ); // myWatcher is not 0 anymore
updateState();
}
Which we are currently using in our codebase to circumvent the issue, even if we have no need for a Watcher.
It also works fine as long as the QtxDockWidget has no parent, and the object is simply destroyed along with the process, but as soon as it has a parent, as far as I understand, Qt tries and destroy children automatically and calls the destructor along the way.
I suggest just adding a check for myWatcher, as seen in other parts of the file
Hi,
We've been upgrading our module to the latest Salome version (9.12.0) and this issue came up.
Basically, the destructor of QtxDockWidget is creating a segfault if the QtxDockWidget hasn't instantiated a Watcher, so when you use the two constructor that don't.
Two constructors of QtxDockWidget just initialize the Watcher object to 0, this one
or this one, that we used to use in our codebase
Which creates an undefined behaviour when calling the destructor
I'm guessing setParent is derenferencing the implicit
this
pointer at some point, which would explain the segfault.Expectedly, it works fine if we use the constructor that instantiates a Watcher object.
Which we are currently using in our codebase to circumvent the issue, even if we have no need for a Watcher.
It also works fine as long as the QtxDockWidget has no parent, and the object is simply destroyed along with the process, but as soon as it has a parent, as far as I understand, Qt tries and destroy children automatically and calls the destructor along the way.
I suggest just adding a check for myWatcher, as seen in other parts of the file
Hope it helps, Guy Tchoumbia.