awesomium / tutorial-framework

Framework to serve as a starting point for tutorials
MIT License
18 stars 7 forks source link

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

Open bbsteel opened 10 years ago

bbsteel commented 10 years ago

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.

Enelar commented 10 years ago

@bbsteel why you didnt use github links? He mean move that to line 30.

bbsteel commented 10 years ago

@Enelar Sorry I am new to github. Now I see every source line is a link, thanks.

Enelar commented 10 years ago

@bbsteel not blaming you. Just my style to give advices. Group of lines still link too(file#L10-20). Everything is link. Commit, diff, diff lines, function, class etc. etc.

Enelar commented 9 years ago

@adamjs