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

SDLx::Text->write_to segfaults #282

Open
dod38fr opened this issue May 22, 2015 · 0 comments
Open

SDLx::Text->write_to segfaults #282

dod38fr opened this issue May 22, 2015 · 0 comments

Comments

@dod38fr
Copy link
Member

dod38fr commented May 22, 2015

Hello

A Debian user has reported a segault with SDLx::Text in Debian bug #772123.

The code that leads to segfault is

#!/usr/bin/perl
use strict;
use SDL;
use SDL::Surface;
use SDLx::App;
use SDLx::Text;

my $dt = 1/60;
my $min_t = 1/60;

my $W = 1680/2;
my $H = 1050/2;

my $wt = 0xFFFFFFFF;
my $bk = 0x000000FF;

my $app = SDLx::App->new(w=>$W, h=>$H, dt=>$dt, min_t=>$min_t);
my $fgs = SDL::Surface->new_from($app, $app->w, $app->h, $app->format->BitsPerPixel, 0, 0, 0, 0);
my $fgt = SDLx::Text->new(h_align => 'center', size => 18, color => $bk, x => $W/2, y => 18);

$app->add_show_handler(sub{
    my($delta,$app)=@_;
    print "boom?\n";
    $fgt->write_to($fgs,"segfault");
    print "no...\n";
});

$app->run();

exit(0);

Using SDL::Surface (not SDLx::Surface) with SDLx::Text is fishy, but I don't know the exact cause of the segfault.

What's your opinion ?

All the best

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

No branches or pull requests

1 participant