Navigation Menu

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

Crash in iPad with iOS 3.2 because of missing contentScaleFactor support #436

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

Comments

@SDLBugzilla
Copy link
Collaborator

SDLBugzilla commented Feb 10, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: iOS 3, iPhone/iPod touch

Comments on the original bug report:

On 2011-06-30 19:03:56 +0000, Joseba García Echebarria wrote:

I just found that SDL is crashing in the iPad simulator for iOS 3.2 but not for iOS 4.2 or over when compiling with Xcode 4.0.2.
The Xcode debugger points to line 127 in video/uikit/SDL_uikitopenglview.m as the line that triggers the crash.
On those lines one can find:

    /* Use the main screen scale (for retina display support) */
    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
            self.contentScaleFactor = [UIScreen mainScreen].scale;

I believe the problem to be that the "scale" selector is supported in iOS 3.2 in the iPad, but contentScaleFactor is not.
I'm no expert in Objective-C, but I believe the following code to be more correct (it doesn't crash for me):
/* Use the main screen scale (for retina display support) */
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [self respondsToSelector:@selector(contentScaleFactor)])
self.contentScaleFactor = [UIScreen mainScreen].scale;

The same check is being performed in line 155 so I imagine it will crash there, too.

On 2011-08-22 17:58:20 +0000, Vittorio Giovara wrote:

Created attachment 681
fix

yeah, -scale was introduced in 3.2 but made available only in 4.0, weird
anyways we just need to check against contentScaleFactor as we can be sure that both are availble starting from 4.0

the attached patch addresses this

On 2011-11-20 09:24:12 +0000, Vittorio Giovara wrote:

Created attachment 729
updated fix for -contentScaleFactor check

I've attached an updated version of the patch.

On 2012-01-06 22:22:10 +0000, Sam Lantinga wrote:

Fixed, thanks!
http://hg.libsdl.org/SDL/rev/67f122d8284f

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