Hi Sebastian,

the problem is that you create the predicates like "notBinary" or "isImage" on 
the stack with the consequence that they are deleted right after the function 
ends. And because you store references to this "ghost" objects in 
"completePredicate", the program crashes.
This is apparently no problem with the predicate classes themselves but with 
their memory management. The documentation says that they are volatile objects 
which should be instantiated, used and then thrown away. However, this is not 
possible for the QmitkDataStorageComboBox-class because it has to save the 
predicate as a pointer in order to decide if a new data node should show up in 
the combobox or not.
We discussed this recently and decided to change the memory management of the 
predicate classes by either using the itk::SmartPointer-concept or by providing 
a manual memory management. We let you know about this soon.

Regards,
Michael

-----Ursprüngliche Nachricht-----
Von: sebastian ordas [mailto:[email protected]] 
Gesendet: Samstag, 11. April 2009 16:59
An: [email protected]
Betreff: [mitk-users] setting a more complete predicate toQmitkDataStorageBox

Hi team,

How can I set a more complete predicate to QmitkDataStorageBox?

The method "SetPredicate" accepts a mitk::NodePredicateBase* and works 
fine with e.g.
SetPredicate( new mitk::NodePredicateDataType("Image") );

But the point comes when trying build a more complete predicate, such as:

mitk::BoolProperty::Pointer myProp = mitk::BoolProperty::New(true);
mitk::NodePredicateProperty isBinary("binary", myProp);
mitk::NodePredicateNOT notBinary(isBinary);
mitk::NodePredicateDataType isImage("Image");
mitk::NodePredicateAND completePredicate( notBinary, isImage );

how can I input "completePredicate" into QmitkDataStorageBox?

If I set it as:

m_TreeNodeSelector->SetPredicate(  (mitk::NodePredicateBase*)  new 
mitk::NodePredicateAND( notBinary, isImage )  );

the program crushes when it is loaded an image that is not binary

any clue?

thanks
sebastian


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to