Description
In the latest version of SequelAce, typing the ( key in the query editor causes SequelAce to crash.
Steps To Reproduce
Expected Behaviour
The key ( should be supported as it's needed in writing SQL 👍
Is Issue Present in Latest Beta?
Yes
Additional Context
This is not an issue in SequelAce 2.1.4. That version has been so stable for me! Something has changed since then.
Potentially caused by https://github.com/Sequel-Ace/Sequel-Ace/pull/356 - check the settings please, if it's enabled or not, I believe that will help debug this issue.
@yg-dba Are you able to provide example of the query causing the issue?
When I disable Bracket Highlighting #356, it works as expected and doesn’t close SequelAce!
Running a simple query like this is a problem when that feature is enabled:
select version();
On Oct 18, 2020, at 6:25 AM, Jakub Kašpar notifications@github.com wrote:
Potentially caused by #356 https://github.com/Sequel-Ace/Sequel-Ace/pull/356 - check the settings please, if it's enabled or not, I believe that will help debug this issue.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/Sequel-Ace/Sequel-Ace/issues/413#issuecomment-711147235, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKUVXZARXYZ6EBAQJEKOMDSLK7BRANCNFSM4SUZQOEQ.
I'm not able to reproduce this issue. Can you share your editor preferences? Can you send crash report?
How can I force the Mac to send a crash report? It was popping up at one point (and I thought automatically sent), but it’s not popping up for me anymore. Attached is a screenshot of the app preferences.
On Oct 18, 2020, at 11:11 AM, Piotr Marnik notifications@github.com wrote:
I'm not able to reproduce this issue. Can you share your editor preferences? Can you send crash report?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/Sequel-Ace/Sequel-Ace/issues/413#issuecomment-711208988, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKUVX6OG5FKQNL2EQYDWDLSLMAQ3ANCNFSM4SUZQOEQ.
@yg-dba I'm afraid that attachment with screenshot is missing. Try go to <home>/Library/Logs/DiagnosticReports directory and find Sequel-Ace related crash report file.

This is a screenshot of the query editor preferences.
Thank you for investigating this issue. I love using Sequel Ace!
Sequel Ace.app.dSYM.zip
These are the DSYMs for 2.2.1 if someone wants to symbolicate. Unfortunately, looking at the log I don't see a clear point where the crash occurred in Sequel Ace code (symbolicated or not), as the crash log just shows some strange crash within macOS. Is this the only crash log from Sequel Ace, @yg-dba?
...
Application Specific Information:
Crashing on exception: -[NSImage set]: unrecognized selector sent to instance 0x600002da1cc0
...
Something what actually is an instance of NSImage is receiving set message ... nothing directly related to brackets highlighting :(
I do have other crash reports. Grep for “Crashing on exception” returns below, not always NSImage.
I just tried again with SELECT version(), and as soon as I typed the ( it closed. The error report looks different. I’m attaching it.
Sequel Ace_2020-10-15-141219_Users-MacBook-Pro.crash:Crashing on exception: -[NSLayoutXAxisAnchor set]: unrecognized selector sent to instance 0x6000021f6980
Sequel Ace_2020-10-16-115514_Users-MacBook-Pro.crash:Crashing on exception: -[NSLayoutDimension set]: unrecognized selector sent to instance 0x6000035a4b00
Sequel Ace_2020-10-17-233525_Users-MacBook-Pro.crash:Crashing on exception: -[NSConcreteValue set]: unrecognized selector sent to instance 0x600001ccf100
Sequel Ace_2020-10-17-234224_Users-MacBook-Pro.crash:Crashing on exception: -[__NSCFDictionary set]: unrecognized selector sent to instance 0x600000294ec0
Sequel Ace_2020-10-18-091408_Users-MacBook-Pro.crash:Crashing on exception: -[NSISIconImageRep set]: unrecognized selector sent to instance 0x600001bbfd80
Sequel Ace_2020-10-18-115910_Users-MacBook-Pro.crash:Crashing on exception: -[NSLayoutXAxisAnchor set]: unrecognized selector sent to instance 0x6000001b0e80
Sequel Ace_2020-10-18-123449_Users-MacBook-Pro.crash:Crashing on exception: -[NSImage set]: unrecognized selector sent to instance 0x600002da1cc0
8 com.sequel-ace.sequel-ace 0x00000001025a6007 0x102491000 + 1134599
corresponds to
-[SPBracketHighlighter highlightOn] (in Sequel Ace) (SPBracketHighlighter.m:84)
So does look like a bracket highlighter crash. Not sure why though. @pmarnik?
Perhaps it's the isValidPosition method?
-(BOOL)isValidPosition:(NSInteger)position {
return (position != NSNotFound && position >= 0 && position < (NSInteger) self.text.length);
}
I'm not too familiar with text range stuff, but if the range has to be length 1, perhaps the max position should be less than self.text.length - 1?
Nope :( this condition is prefectly valid. @Jason-Morcos have you replicated this issue?
@pmarnik I haven't been able to reproduce it either, nope :/
Can confirm this happens on 10.14. Rolling out build environment to it.
@Sequel-Ace/all Should I pause 2.2.1 push? We've probably deployed to most users already.
Any ideas for a fix, @stychos? Appears to be 10.14 exclusive (not a 10.15 bug)
I could not find exact issue. It crashes right after calling highlightOn. Stack frame with offsets looks fine:

Found nearly similar question on StackOverflow: https://stackoverflow.com/questions/43160217/crash-when-updating-nstextstorage-font, but swap of NSTextView to SPTextView didn't help.
As a crutchfix we can disable it on 10.14 ¯_(ツ)_/¯
@Sequel-Ace/all
Paused automated release of 2.2.1. We're 20% deployed already, unfortunately.
If we can't come up with a better fix, we'll have to accept @stychos idea and disable on macOS < 10.15. Or disable completely to be safer..
I'm not sure but looks like it's may be tied to the syntax (not brackets) highlighting.

@stychos Can you check whether #416 fix this issue?
@stychos Can you check whether #416 fix this issue?
Sorry for disappointing, but it's same. Now points more accurately to the addAttribute method:

Does the issue occurs when Syntax highlighting = off and Bracket highlighting = on ?
Does the issue occurs when
Syntax highlighting=offandBracket highlighting=on?
Yes.
Little progress here. Crash happens when the closing bracket is trying to be highlighted. So, with the "Auto pair characters" option enable crash occurs immediately. Without it we can type opening bracket and it crashes when typing closing one.
What about situation when last character in query is something else than bracket?
I mean you start with something like this
SELECT;
^
Cursor just after T and start typing (), so if no crash happen you should end up with:
SELECT();
^
Tried everything, result is the same :( Tried to type SELECT VERSION); and then append with opening bracket.
I was able to get result of https://github.com/Sequel-Ace/Sequel-Ace/issues/413#issuecomment-712600842 when my build of application was configured with enabled Address Sanitizer with Detect use of stack after return on macOs 10.15.4
Alright guys. Looks like macOS 10.14 hates our selected color. It's pretty fine with [NSColor systemRedColor];

How this behaves when you use other hand chosen color?
How this behaves when you use other hand chosen color?
Any custom colours crashing it.
Ohh, interesting... even if you use color that is defined in xcasset @stychos ?
I wonder if we could move from randomly hardcoded colors all over the codebase.
Ohh, interesting... even if you use color that is defined in xcasset @stychos ?
I wonder if we could move from randomly hardcoded colors all over the codebase.
Same crash with [NSColor colorNamed:@"favoriteRed"]; :(
Btw, I was wrong that https://github.com/Sequel-Ace/Sequel-Ace/pull/416 points to exact place with the crash. Stop at the place mentioned in https://github.com/Sequel-Ace/Sequel-Ace/issues/413#issuecomment-712624087 occurs only when there is breakpoint set few lines below (as on screenshot).
I'm giving up for a while :)
Maybe we can use something like this for a while?
Dark:

White:

Gotcha! Looks like self.highlightColor in -(void)highlightOn is something unrelated to the object instance..

Actually this new colour can be used in both versions. I was also thinking how it will behave if highlightColor will be static variable. (https://github.com/pmarnik/Sequel-Ace/tree/fix_413_2)
Actually this new colour can be used in both versions. I was also thinking how it will behave if
highlightColorwill be static variable. (https://github.com/pmarnik/Sequel-Ace/tree/fix_413_2)
It crushes with static o_O
What is crazy difference between hand crafted NSColor and the system one?
Handcrafted one is ok if it's hardcoded inside the method: https://github.com/Sequel-Ace/Sequel-Ace/issues/413#issuecomment-713172626 That's your colour values. I think maybe something wrong with the object instantiation but mine ObjC skills sucks to put some more light on this. Maybe [NSConcreteTextStorage addAttribute] somehow tries to call our object when it is destroyed?
Maybe there is more than one instance of SPBracketHighlighter per editor tab created. Can you try to put some NSLog statement in initializer in order to check it?
Indeed, according to logs initialised only once:
2020-10-20 15:51:57.442337-0700 Sequel Ace[2664:57919] Initialising SPBracketsHighlighter.
2020-10-20 15:51:57.554358-0700 Sequel Ace[2664:57919] -[SPConnectionController reRequestSecureAccess]:3523: reRequestSecureAccess to saved bookmarks
2020-10-20 15:52:27.120381-0700 Sequel Ace[2664:57919] -[NSPDFImageRep set]: unrecognized selector sent to instance 0x6000017ee4c0
As a crutchfix we can disable it on 10.14 ¯_(ツ)_/¯
Can confirm it also crashes on 10.13.6. Needing to grab Xcode 10.1 etc to build and get symbols.
Think I have two fixes:
-fobjc-arc for SPBracketHighlighter.m@property NSColor *highlightColor; to @property(readwrite, retain) NSColor *highlightColor; and add a dealloc() to call [_highlightColor release]. I think 1....
I kind of like this option more: https://github.com/Sequel-Ace/Sequel-Ace/issues/413#issuecomment-713169862
One more reason for that is that we SHOULD try switching to either system colors or xcassets to support dark mode "natively" once we drop older versions later on...
I kind of like this option more: #413 (comment)
Could still use ARC though?
Definitely, the same as you could write this class in Swift and have ARC automatically :))
Definitely, the same as you could write this class in Swift and have ARC automatically :))
I have been doing more in Swift these days 😄 ... see my draggable branch. Also adding Widgets to my iOS app.
Hmmm, how do you detect if the system is dark or light? My query screen stays white in dark mode ...
We do not support it now, we have separate settings for query editor theme... :) Don't waste time on it now. :)
Ok I'll leave it at the -fobjc-arc fix and PR.
Or, @stychos @Kaspik @pmarnik go with the teal? rather than yellow?
For me teal is ok.
For me teal is ok. It's not the thing that stays on screen whole time and it's doing its job. Anyway looks like whole query editor will need some grand refactoring in future and any immediate solution looks to be temporary.
Fixed on master, pending submission and release.
We are unfortunately experiencing some bugs with Apple's App Store process. To anyone affected by this bug, we apologize. In the short-term, to work around the bug you can disable the bracket highlighter in Sequel Ace preferences, or download 2.2.2 Release Candidate 1 from the GitHub releases page. The fix will be pushed out in 2.2.2 as soon as possible.
I just want to comment that I'm so impressed by your kindness and dedication to the open source community that loves and uses SequelAce! I opened this bug just a few days ago, and numerous people have pitched in to try to figure out root cause and the best solution to resolve this issue as soon as possible.
I have personally tried a few other database clients for Mac, and SequelAce is more user friendly and efficient than the others. It will always be my go to DB client :)
Thank you all! Wishing you all the best!
Fixed and released in 2.2.2. :)
Most helpful comment
I just want to comment that I'm so impressed by your kindness and dedication to the open source community that loves and uses SequelAce! I opened this bug just a few days ago, and numerous people have pitched in to try to figure out root cause and the best solution to resolve this issue as soon as possible.
I have personally tried a few other database clients for Mac, and SequelAce is more user friendly and efficient than the others. It will always be my go to DB client :)
Thank you all! Wishing you all the best!