Skip to content

Windows version crash and the reason is in class ViewWin's constructor #3

Open
@bbsteel

Description

@bbsteel

I follow the readme and setting up and building project is fine, but when I run the project , it crashed.

After some analysis, I found the reason is in class ViewWin's constructor.

Before pushing back ViewWin's self pointer to the global view* vector
( the line g_active_views_.push_back(this); is in the end of ViewWin()),
Callback function WndProc() already get the pointer.
(ViewWin* view = ViewWin::GetFromHandle(hWnd);) .

So it will get a null ViewWin pointer in WndProc() , then on WM_SIZE message , function call on null pointer cause crash.

To fix it, in ViewWin(), move g_active_views_.push_back(this); before CreateWindow line.

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