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

Sudden Crash with item details #321

Closed
ASopH opened this issue Aug 11, 2020 · 9 comments
Closed

Sudden Crash with item details #321

ASopH opened this issue Aug 11, 2020 · 9 comments
Labels

Comments

@ASopH
Copy link

ASopH commented Aug 11, 2020

Hello,
I have the following problem:
'Item detais' with this sequence:

$if($stricmp($left(%path%,4),http),📻,💿 )[%album%[ '('$year(%date%)')']$ifgreater(%totaltracks%,1, `'['%tracknumber%/%totaltracks%']',)]

Often when I click in the Playlist to a untagged file foobar crashes . This does often/but not always happen, and rarely it creates a crash-log.
If I remove the sequence by a "//" I had no mistakes.

annexed rarely crash-logs. I hope they can help.
crash reports.zip

Best regards
Arne

@reupen
Copy link
Owner

reupen commented Aug 11, 2020

Thanks for the report and repro steps – I've reproduced the problem.

It's happening because the Windows API function Items details uses (ScriptString_pcOutChars) to work out how many characters fit in the available space is counting the emojis as two code points each, while I was under impression they were one code point each (but two code units in UTF-16). Other functions in that area of the Windows API (Uniscribe) seem to be doing the same.

I'll need to investigate a bit further about how to fix this. But it's affecting those two emojis as their code points in hex are above FFFF. I'd suggest avoiding them for now.

@reupen reupen added the bug label Aug 11, 2020
@ASopH
Copy link
Author

ASopH commented Aug 12, 2020

Hello!
Thanks for the information. The troubleshooting has made me a little crazy. I have the symbols once replaced by words.

Thank you and stay healthy.
Arne

@reupen
Copy link
Owner

reupen commented Aug 18, 2020

Just a note to say I'm still working on a fix. I've needed to rewrite the word wrapping logic (which is complex due to font and colour code support).

Hopefully I'll have something to test in a few days or so.

@ASopH
Copy link
Author

ASopH commented Aug 19, 2020

Nice to hear. I'll take a look then.

reupen added a commit that referenced this issue Aug 22, 2020
#321

This rewrites the sizing and word wrapping logic in the Items detail panel to fix a crash or possible heap corruption when Unicode code points above U+FFFF were encountered.

These changes include making Item details work in only UTF-16 internally; previously there was a mix of UTF-8 and UTF-16 which lead to complexity in counting code units.

Word wrapping behaviour will be slightly different to previous versions as a result of these changes.
reupen added a commit that referenced this issue Aug 22, 2020
#321

This rewrites the sizing and word wrapping logic in the Items detail panel to fix a crash or possible heap corruption when Unicode code points above U+FFFF were encountered.

These changes include making Item details work in only UTF-16 internally; previously there was a mix of UTF-8 and UTF-16 which lead to complexity in counting code units.

Word wrapping behaviour will be slightly different to previous versions as a result of these changes.
reupen added a commit that referenced this issue Aug 23, 2020
#321

This rewrites the sizing and word wrapping logic in the Items detail panel to fix a crash or possible heap corruption when Unicode code points above U+FFFF were encountered.

These changes include making Item details work in only UTF-16 internally; previously there was a mix of UTF-8 and UTF-16 which lead to complexity in counting code units.

Word wrapping behaviour will be slightly different to previous versions as a result of these changes.
reupen added a commit that referenced this issue Aug 23, 2020
#321

This rewrites the sizing and word wrapping logic in the Items detail panel to fix a crash or possible heap corruption when Unicode code points above U+FFFF were encountered.

These changes include making Item details work in only UTF-16 internally; previously there was a mix of UTF-8 and UTF-16 which lead to complexity in counting code units.

Word wrapping behaviour will be slightly different to previous versions as a result of these changes.
@reupen
Copy link
Owner

reupen commented Aug 23, 2020

Hi,

I have a development version available to test:

Download link

In that archive, within VS 2019 v142 Release\vc16\Release\ you'll find an .fb2k-component file that you can install in the usual way (you can ignore the .pdb file).

The crash should be gone, but I'd check that other Item details functionality like $set_font(), $rgb() and word wrapping is still working well if you were using those before.

Thanks!

@ASopH
Copy link
Author

ASopH commented Aug 24, 2020

Hello and thanks!
I've tested... crash seems to be gone, but the horizontal alignment in item details is broken. LEFT is ok, but CENTER looks like <
left center> and right is out of frame!
$rgb() seems to be ok, $set_font I'd never used.
$tab() with no effect (a long time ago). I believe, it's a DUI-problem. I don't have a hydrogenaudio-account to post this.

thanks for your time :-)

reupen added a commit that referenced this issue Aug 24, 2020
#321

This fixes a regression in #323 which broke centre- and right-alignment in Item details when word wrapping was on.
@reupen
Copy link
Owner

reupen commented Aug 24, 2020

Thanks for testing!

I've put a fix in for the alignment – here's a new version.

$tab() has a bit of a history. In some contexts it's used for right-alignment and pseudo-columns. In Default UI, this is just in the status bar now, I believe. I assume you were after normal tab indentation support – it's not a simple matter so it's generally not supported in Columns UI.

@ASopH
Copy link
Author

ASopH commented Aug 25, 2020

Thanks for the info about $tab()!
It seems that the error is gone - the crash and the alignment.
I can see no other error in this case. You can close this if you want.

Thanks again :-)

@reupen
Copy link
Owner

reupen commented Aug 25, 2020

Great. Thanks for testing!

@reupen reupen closed this as completed Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants