Pelles C forum

Pelles C => Bug reports => Topic started by: frankie on November 21, 2021, 12:07:31 pm

Title: IDE crash on autocomplete when casting a pointer
Post by: frankie on November 21, 2021, 12:07:31 pm
In the following snippet :
Code: [Select]
BOOL CALLBACK IoEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch (msg)
    {
        case WM_INITDIALOG:
             MoveWindow(hwnd, (POINT *)lParam-            //As you press '>' to complete pointer symbol autocomplete crashes the IDE
The statement should have been:
Code: [Select]
             MoveWindow(hwnd, ((POINT *)lParam)->x, ((POINT *)lParam)->y, width, height, TRUE);
Title: Re: IDE crash on autocomplete when casting a pointer
Post by: Pelle on November 21, 2021, 06:53:11 pm
I will see if I can reproduce this. Right now I can't...
Title: Re: IDE crash on autocomplete when casting a pointer
Post by: frankie on November 21, 2021, 10:14:57 pm
Thanks Pelle.
I made an error reporting the snippet, now I have fixed it (was missing the 'lParam' in 'MoveWindow(hwnd, (POINT *)lParam-').
I can confirm that it happen almost always when a cast to a pointer is applied.
Title: Re: IDE crash on autocomplete when casting a pointer
Post by: John Z on November 21, 2021, 10:50:33 pm
It crashes version 10 as well.
to reproduce first paste in the line below

MoveWindow(hwnd, ((POINT *)lParam)->x, ((POINT *)lParam)->y, width, height, TRUE);


1) remove second ) shown in red
2) remove first > shown in red
3) now put first > back and then click in the iDE somewhere else.

IDE will go busy then 'not responding' then total crash a few moments later.
Restart IDE and it will ask if you want to restore the open file from a backup.

John Z
Title: Re: IDE crash on autocomplete when casting a pointer
Post by: Pelle on November 22, 2021, 07:25:52 pm
I made an error reporting the snippet, now I have fixed it (was missing the 'lParam' in 'MoveWindow(hwnd, (POINT *)lParam-').
I can confirm that it happen almost always when a cast to a pointer is applied.
OK, thanks, now I can reproduce...

(...even the Visual Studio JIT-debugger catches on, eventually, after a minute or so... not terribly impressive...)