Commit 5d7fa27a authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

comctl32/taskdialog: Fix buttons might disappear.

In the old button layout algorithm, line count is added before adding button. This cause line count buffer overflow when the first button is very long. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 10e4eb8a
...@@ -506,16 +506,15 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info) ...@@ -506,16 +506,15 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
x = h_spacing; x = h_spacing;
for (i = 0, line_count = 0; i < dialog_info->button_count; i++) for (i = 0, line_count = 0; i < dialog_info->button_count; i++)
{ {
if (x + button_layout_infos[i].width + h_spacing >= dialog_width) button_layout_infos[i].line = line_count;
x += button_layout_infos[i].width + h_spacing;
line_widths[line_count] += button_layout_infos[i].width + h_spacing;
if ((i + 1 < dialog_info->button_count) && (x + button_layout_infos[i + 1].width + h_spacing >= dialog_width))
{ {
x = h_spacing; x = h_spacing;
line_count++; line_count++;
} }
button_layout_infos[i].line = line_count;
x += button_layout_infos[i].width + h_spacing;
line_widths[line_count] += button_layout_infos[i].width + h_spacing;
} }
line_count++; line_count++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment