# Paraview Crashes | Debug FIlters in Paraview

**URL:** https://discourse.paraview.org/t/paraview-crashes-debug-filters-in-paraview/11998
**Category:** Development
**Created:** [May 1, 2023, 3:11pm UTC](https://discourse.paraview.org/t/paraview-crashes-debug-filters-in-paraview/11998 "2023-05-01T15:11:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 1, 2023, 3:11pm UTC](https://discourse.paraview.org/t/paraview-crashes-debug-filters-in-paraview/11998/1 "2023-05-01T15:11:12Z")

</div>

Is there a way to debug in Paraview. I am creating a custom filter which is a combination of calculator and glyph filters. For now I have just added calculator filter.  
But after applying my new filter when I click “Apply” Paraview crashes, is there a way to debug what’s going wrong?

I am running Paraview from my directory using this command:

```auto
paraview.exe -l=C:\Users\msaad\paraview.log,TRACE

```

But log files does not show details of debug. This is the snapshot of the log file when I click “Apply”

```auto
( 93.967s) [paraview]vtkStreamingDemandDrive:207 9| . . vtkPVPostFilter (000002019C4846C0) execute-time-dependent-information
( 93.967s) [paraview]vtkStreamingDemandDrive:319 9| . . vtkPVPostFilter (000002019C4846C0) execute-update-extent
( 93.967s) [paraview]vtkStreamingDemandDrive:319 9| . . vtkMyForceFilter (0000020187A74EE0) execute-update-extent
( 93.968s) [paraview]vtkDemandDrivenPipeline:260 9| . . vtkMyForceFilter (0000020187A74EE0) execute-data
( 93.968s) [paraview] vtkSISourceProxy.cxx:306 9| . . { MyForce1: execute

```

Here is my header file, if that can help in debugging. For now I have commented out vtkPVGlyphFilter.

```auto
#ifndef vtkMyForceFilter_h
#define vtkMyForceFilter_h

#include "ForceFiltersModule.h" //needed for exports
#include "vtkPolyDataAlgorithm.h"
#include <vtkPVArrayCalculator.h>
// #include <vtkPVGlyphFilter.h>
// #include "vtkPolyDataAlgorithm.h"
#include "vtkDataSetAlgorithm.h"
#include <string>

class FORCEFILTERS_EXPORT vtkMyForceFilter : public vtkDataSetAlgorithm
{
public:
  static vtkMyForceFilter* New();

  // Wrapper methods to expose vtkPVArrayCalculator and vtkPVGlyphFilter functionalities
  vtkTypeMacro(vtkMyForceFilter, vtkDataSetAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent) override;
  void SetAttributeType(int value);
  void SetCoordinateResults(int value);
  void SetResultNormals(int value);
  void SetResultTCoords(int value);
  void SetResultArrayName(std::string value);
  void SetFunction(std::string value);
  void SetReplaceInvalidValues(int value);
  void SetReplacementValue(double value);
  void SetResultArrayType(int value);
  void SetFunctionParserTypeFromInt(int value);

protected:
  vtkMyForceFilter();
  ~vtkMyForceFilter() override;

  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override;

private:
  vtkMyForceFilter(const vtkMyForceFilter&) = delete;
  void operator=(const vtkMyForceFilter&) = delete;

  vtkSmartPointer<vtkPVArrayCalculator> ArrayCalculator;
// vtkSmartPointer<vtkPVGlyphFilter> GlyphFilter;
  
};

 #endif

```

And here is the RequestData function of my .cxx file:

```auto
int vtkMyForceFilter::RequestData(
    vtkInformation* request,
    vtkInformationVector** inputVector,
    vtkInformationVector* outputVector)
{
    if (!this->ArrayCalculator)
    {
        vtkErrorMacro("Filters not set up properly.");
        return 0;
    }
    // Get input and output data objects
    vtkDataObject* inputData = vtkDataObject::GetData(inputVector[0], 0);
    vtkSmartPointer<vtkDataObject> input = inputData->NewInstance();
    input->ShallowCopy(inputData);

    // vtkDataObject* input = vtkDataObject::GetData(inputVector[0], 0);
    vtkDebugMacro("Input: " << *input);

    if (!input)
    {
        vtkErrorMacro("Input is invalid.");
        return 0;
    }

  

    // Create a new output information vector for the vtkPVArrayCalculator
  
    vtkInformationVector* arrayCalcOutputVector = vtkInformationVector::New();
    vtkDataObject* arrayCalcOutput = vtkDataObject::GetData(inputVector[0]);
    arrayCalcOutputVector->SetInformationObject(0, arrayCalcOutput->GetInformation());

    vtkDebugMacro("ArrayCalculator Function: " << this->ArrayCalculator->GetFunction());

    // Call the vtkPVArrayCalculator's ProcessRequest with REQUEST_DATA key
    this->ArrayCalculator->ProcessRequest(request, inputVector, arrayCalcOutputVector);
    // vtkDebugMacro("vtkPVArrayCalculator output: " << *arrayCalcOutput);

    // Set up the input for vtkPVGlyphFilter
    // vtkInformationVector** glyphInputVector = new vtkInformationVector*[1];
    // glyphInputVector[0] = arrayCalcOutputVector;

    // Call the vtkPVGlyphFilter's ProcessRequest with REQUEST_DATA key
    // this->GlyphFilter->ProcessRequest(request, glyphInputVector, outputVector);

    // vtkDataObject* glyphOutput = vtkDataObject::GetData(outputVector, 0);
    // if (glyphOutput)
    // {
    // vtkDebugMacro("vtkPVGlyphFilter output: " << *glyphOutput);
    // }
    // else
    // {
    // vtkDebugMacro("vtkPVGlyphFilter output is invalid.");
    // }

    // Clean up
    // arrayCalcOutput->Delete();
    // arrayCalcOutputVector->Delete();
    vtkDataObject* output = vtkDataObject::GetData(outputVector, 0);
    output->ShallowCopy(arrayCalcOutput);
    arrayCalcOutput->Delete();
    arrayCalcOutputVector->Delete();

    // delete[] glyphInputVector;

    return 1;
}

```
