Skip to content

Model default constructor does not initialize base Model structure members #351

Description

@AlexDAlexeev

I've found that raylib::Model class is deraived from ::Model structure.
Whe you instantiate raylib::Model with default constructor no any members of ::Model is initialized, under Visual Studio you got all of members filled with some debug non zero values.
When you try to call ~Model destructor you will try to free memory by invalid pointer.

This Code inserted anywhere in main will cause an error:

{
    raylib::Model model;
    // You'll get an exception on block exit
}

Very quick fix - add base structure initialization like this:

/**
 * Model type
 */
class Model : public ::Model {
public:
    Model() : ::Model{}
    {
        // Nothing.
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions