Opened 4 years ago

Closed 2 years ago

#37 closed defect (fixed)

lua first use of setpicturesize resets last changed color

Reported by: HoraK-FDF Owned by: PulkoMandy
Priority: major Milestone: 2.6
Component: GrafX2 Version: 2.5
Keywords: Cc:

Description

Hi,

here is how to reproduce the bug:

  • load a file.
  • change a color or more in the palette editor.
  • run a script that uses setpicturesize. (this only happens the first time, if you than again run a script with setpicturesize that bug don't happen, but if u close grafx2 and start it again it will happen again)
  • after that the last changed color is back to its previous value, (if you change a color multiple times for example from r0 g0 b0 to r127 g127 b127 and than to r255 g255 g255 it will than be r127 g127 b127 after the run of the script) but the color in the palette on the toolbar gets not updated and u can still draw with it, if you place the mouse cursor over that color in the toolbar palette you can see that it has its previous value, the toolbar palette entry and all you have drawn with that color gets changed to the real value (the previous) after entering the palette editor.
  • it also saves the previous color if you save the file.

Attachments (1)

setpicturesize.lua (104 bytes) - added by Thomas Bernard 2 years ago.
test script to reproduce the issue

Download all attachments as: .zip

Change History (8)

comment:1 Changed 3 years ago by PulkoMandy

Milestone: 2.52.6

comment:2 Changed 3 years ago by PulkoMandy

Owner: changed from pulkomandy to PulkoMandy
Status: newassigned

Changed 2 years ago by Thomas Bernard

Attachment: setpicturesize.lua added

test script to reproduce the issue

comment:3 Changed 2 years ago by Thomas Bernard

I reproduce the issue!

comment:4 Changed 2 years ago by Thomas Bernard

The bug is that Backup_with_new_dimensions() does

memcpy(Main.backups->Pages->Palette,Main.backups->Pages->Next->Palette,sizeof(T_Palette));

then calls

Download_infos_page_main(Main.backups->Pages)

which reset the Main.palette to the previous backup...

#0  0x00000000004443d9 in Download_infos_page_main (page=0x8041fcc00) at pages.c:181
#1  0x0000000000445f0a in Backup_with_new_dimensions (width=100, height=100) at pages.c:933
#2  0x00000000004928d4 in L_SetPictureSize (L=0x80409de08) at factory.c:399

comment:5 Changed 2 years ago by Thomas Bernard

I think there should be a call to Upload_infos_page() just before calling Backup_with_new_dimensions()

comment:7 Changed 2 years ago by Thomas Bernard

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.