Loading a Cursor/Icon: Difficulties in Loading

[edit]
As this has gotten fairly long, a quick summary of the below:

It looks like Panda has some very strict–and unclear–requirements for cursor-files. (Specifically, “.cur”-format files.)

With some formats, there’s a crash with what appears to be memory-issues. With another format, the cursor loads–but is partially scrambled. With at least one format, things load pretty much correctly–but there may be an issue with the alpha channel.

I have yet to find a format–at least one that can be outputted by GIMP–that works reliably. :/


[/edit]

I’m trying to load a newly-made custom cursor–specifically, either a “.cur” or “.ico” file. (I’ve tried both formats.) I’m doing this via a call to the “setCursorFilename” method of WindowProperties.

With the cursor-file that I was previously using–also made by me, albeit some time ago–this works as expected.

With the new cursor-file, I instead get a crash, with the error mentioned in the thread-title:

double free or corruption (!prev)

Process finished with exit code 134 (interrupted by signal 6:SIGABRT)

Other programs seem to be able to load the new files without trouble, including my IDE (PyCharm), Ubuntu’s default image-viewer, and GIMP (in which I made the cursor).

Given that the old cursor does work, I’m guessing that there’s something different about this cursor–but I don’t know what.

I’ve even tried comparing the cursor’s header-data to that of the old cursor in a hex-editor, and modifying it to match.

Thoughts?

[edit]
Experimenting with different export settings, I find that “8 bpp, 1-bit alpha, 256-slot palette” instead results in the following error:

free(): invalid next size (normal)

Process finished with exit code 134 (interrupted by signal 6:SIGABRT)

“24 bpp, 1-bit alpha, no palette” allows the cursor to load–but it’s partially scrambled.

And finally, “32 bpp, 8-bit alpha, no palette” results in the cursor loading correctly!

So it seems that Panda simply has a rather strict set of requirements for cursor-files!

[edit 2]

Hum. I’m now seeing some issues with the handling of alpha when using the above-mentioned “32 bpp, 8-bit alpha, no palette” export-settings. Specifically, certain pixels appear to be opaque that are intended to be transparent. :/

Again, the cursor loads as expected in other applications, so this appears to be an issue with however Panda is going about it, so it seems.

Also, I should perhaps note that I’m doing this under Ubuntu Linux, using Panda 1.10.16.

Please file a bug with the crashing files, thanks!

1 Like

Hmm, this is odd! In attempting to build a minimal example-program, I’m not managing to reproduce the crash, or the “scrambled cursor” effect!

I don’t know quite what might be different–a system update, a change in the way that I’m exporting, or… well, what!

I am still seeing the “erased elements are still visible” effect–but that seems to be intermittent: some exported files demonstrate it, while other don’t. Very odd!

Well, for now I’ll hold off on the bug-report, then, as I can’t seem to reproduce the main issue. Perhaps it was some odd confluence of elements, some of which have been updated away–or something!