#πŸ”’ Cant set cursor in pygame

6 messages Β· Page 1 of 1 (latest)

hollow flame
#

Backtrace: https://paste.pythondiscord.com/T45Q

I am trying to set the cursor in pygame to a simple surface in my program, but I get a fatal "bus" error. This happened out of nowhere, as it was working fine all day. I restarted my PC earlier and it started working again. However the issue came back a few hours later, and I'm pretty sure restarting will fix it, but I would like to know what is causing this so I can try to fix it permanently.

I suspect it might have something to do with me using Wayland, but I'm not sure.

Here is a minimum reproducible example:

import pygame

pygame.init()
screen = pygame.display.set_mode((720, 720))

pygame.mouse.set_cursor((0, 0), pygame.Surface((30, 30)))

Any help appreciated.

buoyant compassBOT
#

@hollow flame

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hollow flame
#

anyone?

#
406             SDL_PremultiplyAlpha(surface->w, surface->h,
(gdb) s
SDL_PremultiplyAlpha_REAL (width=72, height=82, src_format=372645892, src=0x1c5a4e0, src_pitch=288, dst_format=372645892, dst=0x7ffff00f9000, dst_pitch=288)
    at /usr/src/libsdl2-2.28.3+dfsg-2/src/video/SDL_surface.c:1507
1507    {
(gdb) s
1514        if (src == NULL) {
(gdb) 
1517        if (!src_pitch) {
(gdb) 
1520        if (dst == NULL) {
(gdb) 
1523        if (!dst_pitch) {
(gdb) 
1526        if (src_format != SDL_PIXELFORMAT_ARGB8888) {
(gdb) 
1529        if (dst_format != SDL_PIXELFORMAT_ARGB8888) {
(gdb) 
1533        while (height--) {
(gdb) 
1536            for (c = width; c; --c) {
(gdb) 
1538                srcpixel = *src_px++;
(gdb) p srcpixel 
$7 = <optimised out>
(gdb) p src_px 
$8 = (const Uint32 *) 0x1c5a4e4
(gdb) p *src_px 
$9 = 0
(gdb) s
1539                RGBA_FROM_ARGB8888(srcpixel, srcR, srcG, srcB, srcA);
(gdb) 

Thread 1 "python3.11" hit Breakpoint 2, SDL_PremultiplyAlpha_REAL (width=72, height=81, src_format=<optimised out>, src=0x1c5a4e0, src_pitch=288, dst_format=<optimised out>, 
    dst=0x7ffff00f9000, dst_pitch=288) at /usr/src/libsdl2-2.28.3+dfsg-2/src/video/SDL_surface.c:1549
1549                *dst_px++ = dstpixel;
(gdb) p dstpixel 
$10 = 0
(gdb) p dst_px
$11 = (Uint32 *) 0x7ffff00f9004
(gdb) p *dst_px
Cannot access memory at address 0x7ffff00f9004

i narrowed it down to this dst_px being inaccessible after it is cast to a uint32

buoyant compassBOT
#

@hollow flame

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.