flat assembler
Message board for the users of flat assembler.

Index > IDE Development > [BUG] Can you reproduce this bug?

Author
Thread Post new topic Reply to topic
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 17 Feb 2010, 20:54
I may have found a bug in FASMW IDE

I am able to reproduce this bug in the following manner:

1) Open numerous source files and assign main file to assembler.
2) Modify any file in some way.
3) Close the window (you will be asked to save these changes)
4) Click cancel.
5) Try to assemble the source...

I have only tried this on one PC (so i hope its not a local bug)

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 17 Feb 2010, 20:54
View user's profile Send private message Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
windwakr 17 Feb 2010, 21:28
What exactly is supposed to happen? When I did that, I couldn't assemble anything. Is that the bug?
Post 17 Feb 2010, 21:28
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 17 Feb 2010, 22:48
try this:

  • open FASMW
  • save and compile
  • delete the saved file (do not close FASMW)
  • compile again
  • voilà... it will save the file again.


This bug gave me a headache these days...
Post 17 Feb 2010, 22:48
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 17 Feb 2010, 23:17
bitshifter wrote:
I may have found a bug in FASMW IDE

I am able to reproduce this bug in the following manner:

1) Open numerous source files and assign main file to assembler.
2) Modify any file in some way.
3) Close the window (you will be asked to save these changes)
4) Click cancel.
5) Try to assemble the source...

I have only tried this on one PC (so i hope its not a local bug)


I did all that you said above, and it re-compiled without crashing Smile . BUT, when I tried to open another file (instead of trying to re-assemble the main file) I got a crash Sad . Re-did two times with the same result, a crash. So, there certainly a bug somewhere. Confused
[EDIT]forgot to add I'm using the latest FASMW package: 1.69.12

[EDIT]
[/b]


Description: Here a Dr. Watson Crash dump file
Download
Filename: drwtsn32.zip
Filesize: 10.79 KB
Downloaded: 707 Time(s)


_________________
Gimme a sledge hammer! I'LL FIX IT!
Post 17 Feb 2010, 23:17
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 18 Feb 2010, 05:39
Ok, it only happens if main (assigned) file not have focus...

New way to test:

1) Open numerous source files and assign main file to assembler.
2) Click a tab ctrl to view any file but the main one.
3) Modify this file in some way.
4) Close the window (you will be asked to save these changes)
5) Click cancel.
6) Try to assemble the source...

FASMW gives focus back to the main (assigned) file and does not assemble.

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 18 Feb 2010, 05:39
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 19 Feb 2010, 13:19
Ok, i think i found why this is happening.
Code:
wmclose:
        mov     [lparam],MB_DEFBUTTON2
      close_window:
        mov     [wparam],0
      check_and_exit:
        mov     [ei.header.mask],TCIF_PARAM+TCIF_TEXT
        mov     [ei.header.pszText],name_buffer
        mov     [ei.header.cchTextMax],100h
        invoke  SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei
        or      eax,eax
        jz      quit
        mov     esi,[ei.pszpath]
        invoke  SendMessage,[ei.hwnd],EM_CANUNDO,0,0
        or      eax,eax
        jz      release_path
        invoke  SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,[wparam],0
        invoke  SendMessage,[hwnd],FM_SELECT,[wparam],0
        mov     eax,MB_ICONQUESTION+MB_YESNOCANCEL
        or      eax,[lparam]
        invoke  MessageBox,[hwnd],_saving_question,[ei.header.pszText],eax
        cmp     eax,IDCANCEL
        je      finish
        cmp     eax,IDNO
        je      release_path
        invoke  SendMessage,[hwnd],WM_COMMAND,IDM_SAVE,0
        or      eax,eax
        jnz     finish
      release_path:
        or      esi,esi
        jz      check_next
        invoke  VirtualFree,esi,0,MEM_RELEASE
      check_next:
        inc     [wparam]
        jmp     check_and_exit
    

I think the problem is that the memory is freed before the user can cancel.
The solution would be to iterate through children checking if dirty or not
then to ask user if save when dirty but not to free memory until last
which means after the user has chosen to save/quit/cancel
I will not provide a fix as TG has his own choice in the matter
but i just wanted to show what were my findings in the code...

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 19 Feb 2010, 13:19
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20335
Location: In your JS exploiting you and your system
revolution 20 Feb 2010, 03:31
So there appear to be two approaches to follow to fix this problem.

1) After each section of memory is released remove the file from the tab list also. Ideally all the memory allocation/release and tab addition/removal should be done by one common atomic function so as to avoid all these sorts of issues.

Or, 2) Produce a dialogue box with the list of all files open and their current dirty statuses. Allow the user to tick/untick things to selectively say which files to save and which to abandon (default could be to have all marked for saving I guess). Then once a single common "save" button is pressed all the actions take place without further user interaction. You can also add "save all" and "save none" buttons along with "cancel" to allow quick global user actions.

I also note that some settings in fasmw can affect how files are saved (thinking tab/space expansion here), so even files that are not "dirty" could also be available as options to save. This way you could load a whole set of files, and without editing, but changing a save setting, you could then re-save all and alter the disk image with the new settings.
Post 20 Feb 2010, 03:31
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 20 Feb 2010, 05:50
I think two loops would be more elegant...
Code:
clear cancel flag...

while(children to process)
{
   if(save was chosen)
   {
      save it...
   }
   else if(cancel was chosen)
   {
      set cancel flag and break out of loop...
   }
}

if(cancel flag not set)
{
   while(memory to free)
   {
      free memory...
   }

   terminate application...
}    

Then it would appear to run normally as intended...
Post 20 Feb 2010, 05:50
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20335
Location: In your JS exploiting you and your system
revolution 12 Apr 2010, 11:55
bitshifter wrote:
I think two loops would be more elegant...
Code:
clear cancel flag...

while(children to process)
{
   if(save was chosen)
   {
      save it...
   }
   else if(cancel was chosen)
   {
      set cancel flag and break out of loop...
   }
}

if(cancel flag not set)
{
   while(memory to free)
   {
      free memory...
   }

   terminate application...
}    

Then it would appear to run normally as intended...
I think Tomasz might have intended to follow this but the second loop is never executed in 1.69.13:
Code:
;...
 jmp     check_before_exiting
        mov     [wparam],0
      release_paths:
      mov     [ei.header.mask],TCIF_PARAM+TCIF_TEXT
       mov     [ei.header.pszText],name_buffer
     mov     [ei.header.cchTextMax],100h
 invoke  SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei
  or      eax,eax
     jz      quit
        mov     esi,[ei.pszpath]
    or      esi,esi
     jz      release_next_path
   invoke  VirtualFree,esi,0,MEM_RELEASE
      release_next_path:
       inc     [wparam]
    jmp     release_paths
      quit:
;...    
The "release_paths" loop is unreachable. Fortunately Windows will free all the memory at program exit so this won't have any lasting effect.
Post 12 Apr 2010, 11:55
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 12 Apr 2010, 18:18
Hmm, i test what you say...
Code:
      release_paths:
        mov     [ei.header.mask],TCIF_PARAM+TCIF_TEXT
        mov     [ei.header.pszText],name_buffer
        mov     [ei.header.cchTextMax],100h
        invoke  SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei
        or      eax,eax
        jz      quit
        mov     esi,[ei.pszpath]
        or      esi,esi
        jz      release_next_path

        invoke  MessageBox,0,release_next_path.message,0,0

        invoke  VirtualFree,esi,0,MEM_RELEASE
      release_next_path:
        inc     [wparam]
        jmp     release_paths

  .message db 'Releasing memory...',0

      quit:    
Post 12 Apr 2010, 18:18
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 13 Apr 2010, 03:50
I fix code?
Code:
wmclose:
        mov     [lparam],MB_DEFBUTTON2
      close_window:
        mov     [wparam],0
      check_before_exiting:
        mov     [ei.header.mask],TCIF_PARAM+TCIF_TEXT
        mov     [ei.header.pszText],name_buffer
        mov     [ei.header.cchTextMax],100h
        invoke  SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei
        or      eax,eax
       ;jz      quit             ; REMOVE <-----------------------------------
        jz      no_more_children ; INSERT <-----------------------------------
        mov     esi,[ei.pszpath]
        invoke  SendMessage,[ei.hwnd],EM_CANUNDO,0,0
        or      eax,eax
        jz      check_next
        invoke  SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,[wparam],0
        invoke  SendMessage,[hwnd],FM_SELECT,[wparam],0
        mov     eax,MB_ICONQUESTION+MB_YESNOCANCEL
        or      eax,[lparam]
        invoke  MessageBox,[hwnd],_saving_question,[ei.header.pszText],eax
        cmp     eax,IDCANCEL
        je      finish
        cmp     eax,IDNO
        je      check_next
        invoke  SendMessage,[hwnd],WM_COMMAND,IDM_SAVE,0
        or      eax,eax
        jnz     finish
      check_next:
        inc     [wparam]
        jmp     check_before_exiting
  no_more_children: ; INSERT <-----------------------------------
        mov     [wparam],0
      release_paths:
        invoke  MessageBox,0,0,0,0 ; INSERT <--------------------------------
        mov     [ei.header.mask],TCIF_PARAM+TCIF_TEXT
        mov     [ei.header.pszText],name_buffer
        mov     [ei.header.cchTextMax],100h
        invoke  SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei
        or      eax,eax
        jz      quit
        mov     esi,[ei.pszpath]
        or      esi,esi
        jz      release_next_path
        invoke  VirtualFree,esi,0,MEM_RELEASE
      release_next_path:
        inc     [wparam]
        jmp     release_paths
      quit:
      ...    

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 13 Apr 2010, 03:50
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20335
Location: In your JS exploiting you and your system
revolution 13 Apr 2010, 04:26
bitshifter wrote:
Code:
no_more_children    
What will happen to the human race? Crying or Very sad
Post 13 Apr 2010, 04:26
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 13 Apr 2010, 05:25
Optional label:
Code:
delete_childrens_memory    
Post 13 Apr 2010, 05:25
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 13 Apr 2010, 08:18
bitshifter wrote:
I fix code?
Wasn't it simpler to download the updated package? It's there since yesterday. Wink
Post 13 Apr 2010, 08:18
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20335
Location: In your JS exploiting you and your system
revolution 13 Apr 2010, 09:11
Tomasz Grysztar wrote:
Wasn't it simpler to download the updated package? It's there since yesterday. Wink
Thanks Mr. Silent Updater. Evil or Very Mad
Post 13 Apr 2010, 09:11
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 13 Apr 2010, 12:55
Tomasz Grysztar wrote:
Wasn't it simpler to download the updated package? It's there since yesterday. Wink
Not with my 5kbps connection.
It was actually faster to learn/fix code.

Also, why this?
Code:
        or      eax,eax
        jz      check_done
        mov     esi,[ei.pszpath] ; <-------------------------- WTF?
        invoke  SendMessage,[ei.hwnd],EM_CANUNDO,0,0
        or      eax,eax
        jz      check_next    

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 13 Apr 2010, 12:55
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.