Skip to main content
Participant
December 8, 2023
Answered

Error while rendering with multiple effects with code 1397908844 using PF_NewWorld, PF_DisposeWorld

  • December 8, 2023
  • 2 replies
  • 1671 views

Hello,

I am working on a simple AE plugin that creates some layers (world) and let an external function do the rendering. It works well on preview, and when rendered alone (when having only one effect). However if I add another effect like noise, and when I do the rendering I get this error code 1397908844. The std::exception indicates that concerns vector deallocation problem. I tried on a very simple example (in entry_point) with my plugin and the noise effect and get the same results. Here is the code I have for the smart rendering function:

PF_Err entry_point(
    PF_Cmd cmd,
    PF_InData* in_data,
    PF_OutData* out_data,
    PF_ParamDef* params[],
    PF_LayerDef* output,
    void* extra)
{
    PF_Err err = PF_Err_NONE;
    try 
    {
        switch (cmd) 
        {
        // ...
        case PF_Cmd_SMART_RENDER:
        {
            PF_SmartRenderExtra* extraa = reinterpret_cast<PF_SmartRenderExtra*>(extra);
            
            // Get input and output.
            PF_EffectWorld* input = nullptr;
            PF_EffectWorld* output = nullptr;
            throw_if_err(extraa->cb->checkout_layer_pixels(in_data->effect_ref, 0, &input));
            throw_if_err(extraa->cb->checkout_output(in_data->effect_ref, &output));
            
            // Copy input to output.
            A_long linesS = output->extent_hint.bottom - output->extent_hint.top;
            throw_if_err(in_data->utils->copy(in_data->effect_ref, input, output, nullptr, nullptr));

            PF_LayerDef layer;
                        
            // Allocate new layer.
            {
                const int width = output->width;
                const int height = output->height;
                const bool clear_pixels = false;
                AEFX_SuiteScoper<PF_WorldSuite2> world_suite(in_data, kPFWorldSuite, kPFWorldSuiteVersion2);
                throw_if_err(world_suite->PF_NewWorld(in_data->effect_ref, width, height, clear_pixels, PF_PixelFormat_ARGB128, &layer));
                throw_if_err(in_data->pica_basicP->ReleaseSuite(kPFWorldSuite, kPFWorldSuiteVersion2));
                assert(layer.data);
            }
            
            // Deallocate layer.
            {
                AEFX_SuiteScoper<PF_WorldSuite2> world_suite(in_data, kPFWorldSuite, kPFWorldSuiteVersion2);
                throw_if_err(world_suite->PF_DisposeWorld(in_data->effect_ref, &layer));
                throw_if_err(in_data->pica_basicP->ReleaseSuite(kPFWorldSuite, kPFWorldSuiteVersion2));
            }
        }
        // ...

        }
    }
    catch (ErrException& thrown_err)
    {
        err = thrown_err.err;
    }
    return err;
}

If anyone could help, thanks.

 

Notes: I am using After Effects 22.6.5 on Windows 11.

Correct answer tanguyc6318348

I actually realised that the class AEFX_SuiteScoper releases the suite when being destroyed (without sending any error since it is the destructor). In my code, after allocation and deallocation I manually release the suite which makes this operation executed twice. I removed the following lines and it works normally:

throw_if_err(in_data->pica_basicP->ReleaseSuite(kPFWorldSuite, kPFWorldSuiteVersion2));

2 replies

tanguyc6318348AuthorCorrect answer
Participant
December 11, 2023

I actually realised that the class AEFX_SuiteScoper releases the suite when being destroyed (without sending any error since it is the destructor). In my code, after allocation and deallocation I manually release the suite which makes this operation executed twice. I removed the following lines and it works normally:

throw_if_err(in_data->pica_basicP->ReleaseSuite(kPFWorldSuite, kPFWorldSuiteVersion2));
Community Expert
December 8, 2023

did you do some elimination? on what line's execution is the error thrown?

Participant
December 11, 2023

Thanks for the quick response! Please check my answer below.