Purpose

The module BadModule commits as many errors as possible. This can be useful to make stability checks of your aplication or to test test modules. That however might let your MeVisLab or application crash if you use it.

Usage

Better do not use it in normal working contexts.

The module, however, can be quite useful when placed in your application to check how resistent it is against crashes, e.g. to see whether the error handler receives the messages, whether exception handling is configured right and whether all messages are redirected correctly into log files.

Details

Here an overview about errors committed by BadModule.

Constructor:

  • It produces some memory leaks:
    • a ten bytes malloc leak
    • a 24 byte leak by new (48 bytes on 64 bit systems)
    • a new vector leak of 100 bytes.
    • It creates 111 bytes with new in _newData.
    • It allocates 47 bytes with malloc in _mallocData.
  • It adds some bad fields:
    • one with underscore used at beginning of field name ("_invalidField1").
    • one with space used in field name ("inv alidField2").
    • one with an invalid character used in field name ("inv%alidField3").
    • one with an undesired capital letter as first character of field name ("InvalidField4").
    • two fields with same name ("fieldUsedTwice").
    • a long double _fillVal field with name "fillVal" with value 0.
    • a field whose runtime type is not initialized ("notInited") if a compiler switch in mlDiagnosisInit is set appropriately.
    • one field accessing a NULL pointer when notified ("triggerCrash").

Destructor:

  • Does nothing. It also does NOT free nor delete previously allocated memory.

activateAttachments:

  • Called after field updates by reloads or clones which do not notify field changes.
  • It does NOT update the member _fillVal which normally would be necessary.

handleNotification:

  • It produces a memory leak of 23 malloced bytes when called.
  • It reads a float from NULL pointer when _triggerCrashFld is handled.

calculateOutputImageProperties:

  • Specifies output image properties.
    • It produces a 57 byte new vector memory leak.
    • It changes page properties to undesired page extents (1x1x3x1x1x2).
    • It sets 0x1x-1x3x2x7 as image extents.
    • It specifies an invalid image data type (-2).
    • It sets a max voxel value smaller than a minimum voxel value (3, -4).

calculateOutputSubImage:

  • It produces a 4 byte new memory leak (8 byte on 64 bit systems) on each calculated page.
  • It writes one voxel more before page begin and after page end.

Windows

Default Panel

../../../Modules/ML/MLDiagnosis/mhelp/Images/Screenshots/BadModule._default.png

Input Fields

input0

name: input0, type: Image

Output Fields

output0

name: output0, type: Image

Parameter Fields

Field Index

_invalid Field1: Integer Trigger Crash: Trigger
Field Used Twice (fieldUsedTwice): Vector3  
Field Used Twice (fieldUsedTwice): Vector3  
Fill Val: Double  
Inv alid Field2: Float  
Inv%alid Field3: String  
Invalid Field4: String  
notInited: String  

Visible Fields

_invalid Field1

name: _invalidField1, type: Integer, default: 0

Underscore is not allowed at the beginning of a field's name.

Inv alid Field2

name: inv alidField2, type: Float, default: 0

A space is not allowed in a field's name.

Inv%alid Field3

name: inv%alidField3, type: String

A percent symbol is not allowed in a field's name.

Invalid Field4

name: InvalidField4, type: String

A field's name must not start with a capital letter.

Field Used Twice (fieldUsedTwice)

name: fieldUsedTwice, type: Vector3, default: 0 0 0

A name of a field must be unique.

Field Used Twice (fieldUsedTwice)

name: fieldUsedTwice, type: Vector3, default: 0 0 0

A name of a field must be unique.

Fill Val

name: fillVal, type: Double, default: 0

This field's value is stored in a module's member variable but the member is not initialized in the module's ml::FieldContainer::activateAttachments method as it should be.

Trigger Crash

name: triggerCrash, type: Trigger

Causes the module to crash because an array access is attempted at NULL.

Hidden Fields

notInited

name: notInited, type: String