Opened 8 years ago

Closed 5 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 6 years ago.
test script to reproduce the issue

Download all attachments as: .zip

Change History (8)

comment:1 by PulkoMandy, 6 years ago

Milestone: 2.52.6

comment:2 by PulkoMandy, 6 years ago

Owner: changed from pulkomandy to PulkoMandy
Status: newassigned

by Thomas Bernard, 6 years ago

Attachment: setpicturesize.lua added

test script to reproduce the issue

comment:3 by Thomas Bernard, 6 years ago

I reproduce the issue!

comment:4 by Thomas Bernard, 6 years ago

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 by Thomas Bernard, 6 years ago

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

comment:7 by Thomas Bernard, 5 years ago

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