Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASEprtie crashes when editing the palette #185

Closed
aseprite-bot opened this issue Aug 20, 2014 · 5 comments
Closed

ASEprtie crashes when editing the palette #185

aseprite-bot opened this issue Aug 20, 2014 · 5 comments

Comments

@aseprite-bot
Copy link
Collaborator

From wolfenan...@gmail.com on November 22, 2012 01:10:11

What steps will reproduce the problem? 1. Click on the "Edit Palette" button.
2. Edit any palette entry by having the first RGB value at 0 and the pointer after that.
3. Type in "1", then "8". What is the expected output? What do you see instead? The expected output is the value "18" being in the R section in RGB. Instead, ASEprite crashes completely. What version of the product are you using? On what operating system? v.0.9.5 is the installed version and the OS is Windows 7.

Original issue: http://code.google.com/p/aseprite/issues/detail?id=185

@aseprite-bot aseprite-bot added this to the v0.9 milestone Aug 20, 2014
@aseprite-bot
Copy link
Collaborator Author

From wolfenan...@gmail.com on November 21, 2012 20:13:45

I wentd to check and see if this was just some random occurrence. Sadly, it is not. ASEprite crashes if you type "18 into any value in RGB and HSB when in the "Edit Palette" window. It also crashes if you merely click a color and try and edit it as such.

@aseprite-bot
Copy link
Collaborator Author

From eoin.mcl...@gmail.com on May 11, 2013 12:10:57

Hello gents,

I hit this same problem and spent some time digging into it. What happens is that when the text entry box starts with a value of "0," then you type in a new value, the colour sliders get updated and then do a setTextF("%d", newColourValue) back on the text entry box. This causes the string to change from (e.g) "01" to "1", but the text entry box doesn't know that the string has been truncated, so the m_caret is indexing outside the string. On the next keypress, we'll attempt to insert a character past the end of the text.

I've attached a patch. Here's how I fixed it:

Make ui::Widget::setTextf virtual

Override ui::Widget::setTextf in ui::Entry and call the base implementation

Clamp ui::Entry::m_caret to the length of the string

Eoin

Attachment: 0001-Issue-185-ASEprtie-crashes-when-editing-the-palette.patch 0002-Issue-185-ASEprtie-crashes-when-editing-the-palette.patch

@aseprite-bot
Copy link
Collaborator Author

From davidcapello on May 11, 2013 14:35:18

Hi Eoin, I think I've already fixed this in dev branch (not yet released): dacap@fe6209e If you can confirm me that this bug is fixed in that commit, I think I'll close this issue (to be released with 0.9.6 soon).

Status: Accepted
Owner: davidcapello
Labels: -Priority-Medium Priority-High Milestone-0.9

@aseprite-bot
Copy link
Collaborator Author

From eoin.mcl...@gmail.com on May 12, 2013 02:32:25

Cool, that does fix it.

While we're at it, the behaviour of deleting text in the colour value entries feels a little odd. If you backspace, deleting all the text, the empty text box will be replaced with "0" but our cursor will be pointing at the start. So things like this sequence feels clunky:

Set colour value to "1"

Put cursor at end of string

Backspace (i.e. delete the 1) character

Press '1' again.

Now, the value is "10", rather than "1", which I would have expected. To get the value of "1", I need to forward-delete that zero after I've typed some other value.

Maybe we could also do something like in the attached patch? Though, I haven't vetted all the other code for places set the text in the ui::Entry...

Eoin

Attachment: 0001-Increment-cursor-if-colour-sliders-have-added-a-char.patch

@aseprite-bot
Copy link
Collaborator Author

From DocHoncho@gmail.com on November 29, 2013 15:09:32

Status: Verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant