GammaThingy icon indicating copy to clipboard operation
GammaThingy copied to clipboard

crash on enable toggle

Open moshesiegel opened this issue 9 years ago • 18 comments

running 9.1 beta 4 on my 6: app immediately crashes on toggling on/off yet it will change the gamma color but its not adjustable.

moshesiegel avatar Oct 10 '15 01:10 moshesiegel

Debugging the crash, i see __stack_chk_fail on libsystem_c.dylib after Frame Buffer is set with new Gamma values.

AnnoyinSamurai avatar Oct 10 '15 03:10 AnnoyinSamurai

Are you compiling for all architectures, including arm64? I noticed that it only works if targeting armv7. I was trying to write a today widget for it (arm64 only) and then ran into this issue.

angeloalduino avatar Oct 10 '15 21:10 angeloalduino

@glassbot: If you're running iOS 7 or later, you need go into GammaController.m:102 and change:

uint32_t data[0xc00 / sizeof(uint32_t)];

to

uint32_t data[0xc0c / sizeof(uint32_t)];

EDIT: Numbers flipped around, my bad.

Rivm avatar Oct 10 '15 21:10 Rivm

@angeloalduino that fixed it, I was compiling for the latest but when I set they deployment target back to 7 it worked.

Thanks.

On Sat, Oct 10, 2015 at 5:47 PM, Angelo Alduino [email protected] wrote:

Are you compiling for all architectures, including arm64? I noticed that it only works if targeting armv7. I was trying to write a today widget for it (arm64 only) and then ran into this issue.

— Reply to this email directly or view it on GitHub https://github.com/thomasfinch/GammaThingy/issues/8#issuecomment-147128417 .

moshesiegel avatar Oct 10 '15 22:10 moshesiegel

@Rivm I have it set to 0xc00 already, i will try deployment target fix later today. Thanks.

AnnoyinSamurai avatar Oct 11 '15 00:10 AnnoyinSamurai

Wow oops, I accidentally had the change "" and to "" reversed. In iOS 7, the gamma table struct's unsigned array size changed from 0x100 to 0x101. So, if my math checks out...

Old: 0x100 * sizeof(unsigned int) * 3 = 3072 or 0xc00 New: 0x101 * sizeof(unsigned int) * 3 = 3084 or 0xc0c

Rivm avatar Oct 11 '15 00:10 Rivm

@Rivm Yup, 0xc0c worked. Another issue i noticed , after disabling the screen still has orange tint left requiring a reset.

AnnoyinSamurai avatar Oct 11 '15 03:10 AnnoyinSamurai

My current PR includes a commit where I added proper ARM64 support using @glassbot's solution.

Edit: The specific commit has been merged, this issue should be fixed now.

luuuke avatar Oct 11 '15 22:10 luuuke

I've pulled the latest commit, running it on iPad 4th Gen still crashes the app for me. It works fine on my iPhone 6. I set added a breakpoint, and it's stopping at GammaController.m:122:

error = IOMobileFramebufferGetGammaTable(fb, data);

esusatyo avatar Oct 12 '15 11:10 esusatyo

I just realized that this issue doesn't depend on architecture as suggested above, I've updated my fork in this regard. Should be fixed now.

luuuke avatar Oct 13 '15 16:10 luuuke

Still crashing here (iPhone 6S, iOS 9.1) as soon as I try to use any of the controls. Gamma effect not initiated. Any ideas? Thanks!

blcs79 avatar Nov 02 '15 03:11 blcs79

In newest HEAD, I've got constant crashes due to this commit: https://github.com/thomasfinch/GammaThingy/commit/624664866decadaab08dc57a9a04156b0feb3bc0

If I change it back, GammaThingy works normally (have not tried the widget though).

Edit: It seems there's still some glitches with wrong colors, even without using the widget. If removing this change. However, it does not work at all for me (the file!=NULL assert is triggered).

mkasu avatar Nov 02 '15 12:11 mkasu

@mkasu You may have an APP_GROUP_IDENTIFIER change missing. I found I missed the change in Info.plist (see screenshot), then had to do a clean and build to update the app.

screen shot 2015-11-03 at 11 11 24 am

agentk avatar Nov 03 '15 00:11 agentk

@agentk Thanks. Got it to work. It seems just the clean-step was missing for me (already had changed the identifiers previously).

mkasu avatar Nov 03 '15 19:11 mkasu

@agentk Thanks. I have zero experience in Xcode and always had a crash when trying to interact with the compiled app. Search for the APP_GROUP_IDENTIFIER and added my group fixed it.

patrickwelker avatar Nov 08 '15 19:11 patrickwelker

@agentk Thanks, clean & build was the piece I was missing, too.

paulrudy avatar Nov 15 '15 19:11 paulrudy

It still does not work for me - looks like a (setting?) file is missing. 2015-12-08 00:11:43.581 GammaTest[4778:1635401] enabled: 1 2015-12-08 00:11:43.591 GammaTest[4778:1635401] Lock status: 0 Assertion failed: (file != NULL), function +[GammaController setGammaWithRed:green:blue:], file /Users/patmuk/code/sideload/iPhone/GammaThingy/GammaTest/mvc/controller/GammaController.m, line 138. from this code:


137 file = fopen([filePath UTF8String], "wb"); 138 assert(file != NULL);

patmuk avatar Dec 07 '15 23:12 patmuk

@patmuk That is the same error I was getting too. The filePath is based on the APP_GROUP_IDENTIFIER. Ensure it is set correctly in the project level settings, and not overridden in the targets, and that it matches what you entered in Capabilities -> App Group. Then clean and rebuild.

Just setting the bundle and group identifiers in General and Capabilities is not enough. You need to search for the value in build settings too.

The clean is important too as this change at the project level does not cause the build to be updated unless you clean first.

agentk avatar Dec 09 '15 11:12 agentk