-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
[Bug] segmentation fault on listing the windows t-rec -l
#4
Comments
Could you please also share the graphics card on your mac? Like from "About this Mac" > "Displays" |
@sassman
|
@Ryuta69 thanks. Also maybe you can check for some headers on your system: And run |
@sassman
// /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreGraphics.framework/Versions/Current/Headers/CGWindow.h
/* Return an array of window dictionaries for windows within the user
session.
This function returns NULL if the caller is not running within a Quartz
GUI session or the window server is disabled. You should release the
array when you are finished using it. */
CG_EXTERN CFArrayRef __nullable CGWindowListCopyWindowInfo(CGWindowListOption option,
CGWindowID relativeToWindow)
CG_AVAILABLE_STARTING(10.5);
I'm afraid but I don't clearly get this means. But -- P.S. |
Very interesting, seems that is somehow graphics card related. But actually this whole crash should be prevented. So I will dig into that deeper. One last thing I've noticed, when the mac screen recording permission are not granted, then the app also misbehaves, can you check that iTerm for example is authorized with a checkbox there: |
Thank you for your researching, I also will look into.
Right now, there is no checkbox for iTerm nor plus button to add iTerm. I believe this will show alert to permit when it requires (Maybe after segmentation fault is resolved...?) |
On start there should be a pop up coming that requests you to allow the recoding by iTerm Additionally, I committed a fix to the main branch, that should do more checks and give more output.
and then redo a recording. |
Thank you very much! P.S. |
@sassman |
Sorry pushed it as a wrong branch. Now you can try. |
@sassman It will take time (maybe not possible to fix from rust code side) to create PR, so I describe why this error caused. First of all it was not because of graphic card. The error was caused here. // src/macos/window_id.rs
unsafe {
CFRelease(window_list_info as CFTypeRef);
} Almost all application is fine with this, however, Übersicht does wrong. I think this is because of char code \u{308} does, because after I changed app name by editing info.plist of App, it works. After I remove Übersicht and run correctly, this alert pops up.
RemarksAs I said, almost all of apps works correctly, even with Japanese-Named-Apps or Chinese-Named-Apps. |
The umlaut "Ü" causes it. Very interesting. I will add some charset safety checks and also try to reproduce it. What app is it that is called "Übersicht" for you (maybe I can install it simply)? |
Thank you for safety check proposal, I think it's a good idea. Download: http://tracesof.net/uebersicht/ |
Thanks, I can directly reproduce the issue now. |
Additional Info (If this is an obvious thing, sorry. I really don't know anything about MacOS CoreFoundation). If I modify the code below, t-rec-rs/src/macos/window_id.rs Lines 26 to 30 in f65af3b
into below.
Now, the error won't cause even with Übersicht. (OTOH, this makes functions I think I am too lack of understanding CoreFoundation, so will stop my own PR... Thank you for reviewing my report. This is really good OSS. |
Thanks for all the details, I found the reason. The Objective C runtime took over the memory ownership, of an item that it does not own. So that caused on the Can you please verify on the main branch if the problem is solved for you? |
- add more error checking and context to the lowlevel api calls - CFReleae caused a segmentation fault, related to a wrong treated memory onwership of a NSString variable - Add a bit safety for utf8 related issues on window name retrieval
This fix is now included in v0.1.1 and published. |
t-rec -l
@sassman Thank you very much for quick fix! |
@Ryuta69 thanks for your detailed feedback. The new version is just published on crates.io. |
Describe the bug
Whenever I run t-rec, it causes
segmentation fault
error.t-rec /bin/sh
results same.To Reproduce
Steps to reproduce the behavior:
t-rec
.Expected behavior
It doesn't cause segmentation fault, and run correctly.
Screenshots
zsh: error on TTY read: Input/output error
if you specified zsh, bash. However, sh won't lead this error.Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: