Skip to content

Order of initialization might be wrong #1

@kiskit

Description

@kiskit

Hello,

First and foremost, I'm not 100% certain of what I'm going to say, but...
In AppComponent.hpp, you initialize the m_cmdArgs member in the contructor (line 28).
A bit later in the code (line 70), you use the OATPP_CREATE_COMPONENT macro to create a component, and in the associated lambda, you try to use that m_cmdArgs member.
I've been struggling with my own code and I suspect it's because the OATPP_CREATE_COMPONENT macro (and most of all the lambda) will be executed before the AppComponent constructor.
So I think that, in you code, you try to make use of a member that has not been initialized.
On a more generic note, I've been trying to pass a configuration structure to that constructor. If I'm right, all component members that depend on it must be initialized differently, like in the body of the constructor. Maybe it's worth mentioning somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions