makeKeyAndOrderFront: again causes EXC_BAD_ACCESS - cocoa

Im sure this is something really simple I'm missing. I use makeKeyAndOrderFront: to open a window and it works the first time. When I close the window and try and open it again it quits and gives me the error EXC_BAD_ACCESS. My code is this:
- (IBAction)viewScreen:(id)sender {
[screenView makeKeyAndOrderFront:sender];
}
I can't figure out why this is happening and the debugger console isn't saying much of anything.
Thanks in advance

Why are you calling your window variable screenView? That sounds like it should refer to a view, not a window.
Check whether your window has the “Release when closed” property turned on in IB. When that property is on, the window will release itself when anything or anybody closes it. This can be handy, but if you intend to show the same window again later on, it's probably not what you want.
More generally, you can use Instruments's Zombies template to debug crashes like this.

Related

Component request is being processed

I see this message in VB6 again and again from time to time since I can remember, and now after like 15 years, I would like to ask if somebody knows how to get rid of this message.
I don't know when it occurs, but when it does, I can not click this window away.
It keeps flickering and does not go away:
In English:
"The action cannot be completed because the other application is unavailable. Click 'Switch to' to activate the other application and fix the problem. 'Switch to...', 'Repeat', 'Cancel' "
I don't really know what the message means. I would guess it wants to tell me that it waits for a component to respond.
But no longer how long I wait, it does not finish.
Does anybody know a trick how to close this window?
Sometimes I can still try to close VB6, and it will go away and allow me to save the edited files, but often, I have to terminate VB6 using the task mananger, and then my changes are lost.
I would like to avoid this.
Thank you!
Edit: It seems that the problem occurs when I use the clipboard.
Each time right now when I use Ctrl + V to paste something, this happens.

How to navigate through code while having the QuickView window open?

When something throws an exception I usually click on "View details" which brings the QuickWatch window into the foreground and let's me examine the occurred exception.
What really bugs me is that I am not able to browse/search through my code having the QuickWatch window open next to it. I first have to close the window.
Is there a way to keep the window open when in break? Maybe there is another approach?
Is there a way to keep the window open when in break? Maybe there is
another approach?
Actually, there is no such function to browse or search the source code when you call Quick Watch window. And when you call the Quick Window, it will lock the current interface and we cannot do any other operation on other window. And this is the Quick Window feature in Debug mode.
Is there a way to keep the window open when in break? Maybe there is
another approach?
In fact, there is no such function to achieve your goal. Detecting exceptions is the job of the Debug mode process. If Debug mode is broken, the exception cannot be monitored, so it cannot be implemented. It must be based on Debug mode to capture.
As a suggestion, you can try this:
Suggestion
1) When you achieve the Error Exception User Unhandled under Debug mode, you can first browse/search through your code in Code Editor.
2) After that, you can keep the current interface of your code section, open Quick Watch Window(Debug-->QuickWatch)-->input $exception in the Expression textbox and click Reevaluate.
And this will be the same as shown earlier.

Firefox hangs when using developer tools

I am getting a little desperate here: Almost every time I try to use the Firefox browser tools (FF 66.0.3 on Mac, but has been the same in previous versions) to inspect an element, when selecting any page element to show its code in the inspector, the inspector switches to the javascript debugger, marks an error in the jquery.min.js file (complete first line of three) and causes the browser to hang, i.e. I can still scroll the window, but more or less nothing else (for example no reload, no clicking a link would work etc.)
The debugger shows Error: Permission denied to access property "nodeName". I am doing nothing special, I just use the inspector and try to select any element on the page.
The crazy thing is that this happens on most websites, even here on Stackoverflow, so I suppose some particular browser setting must cause this.
I know this is a vague description and therefore a bit off-topic, but I'd be very grateful for any hints how I could fix this.
You most probably have the "Pause on exceptions" and "Pause on caught exceptions" options set to on:
These will cause the debugger to pause javascript execution whenever an exception is thrown, even though the exception has been caught e.g by a try catch block, like many test codes use.
You can un-toggle these to enjoy a more natural experience or click the play icon to resume the javascript.

How to find source of print() or NSLog() console output in Xcode

I'm not sure if this is possible. Here is an example situation:
Something is printing to my console and I don't know where it is coming from in the code. I did a quick search using the Finder in Xcode on terms such as 'NSLog' and 'print'. Nothing relevant came up.
Is there any quick way that Xcode has of finding where the source of the output is coming from ?
Kind of like when you right click on a method and you have all the options of exploring different parts of the code associated with that method.
Also: are there other functions that print besides NSLog and print?
Thanks so much!
Try running in the debugger, with breakpoints set on printf, NSLog, etc. When you hit a breakpoint do a backtrace (bt) to see where it's being called from
There's a plugin LinkedLog for that. You replace all NSLogs with LLogs and then will be able to just tap on link in Xcode's console to get to the line caused it to appear.
Didn't try it myself, but definitely will.

Cannot complete a basic task in QT4

I cannot open a new window in QT. I new in QT so I think I am missing something. I only write the code below and settings windows just shows itself and closes. I have commented out destructor but still problem persists.
SettingsWindow s;
s.show();
What do I do wrong ? By the way I cannot either debug it, debuger does not stop when it reaches to the first line for example.
Thanks
This can't possibly be the only code you wrote.
However, judging from your description the first thing that comes to mind is probably a missing call to QApplication::exec(). Somewhere in the code you haven't shown here there's an instance of QApplication, probably named app. After calling show on your window, make sure there's a call to exec.
Since you are using a non-pointer var, your window is destroy when it go our of scope (at the end of the function). If you use a pointer when exiting the function the memory is not deleted so you Windows will still be shown. But you will not be able to clean memory when closing the window if you can't anymore access to your pointer.
Maybe you need to create your window as member of the calling class in order to be able to destroy the window AND clean memory once you don't need anymore to display it (for example in the calling class destructor).

Resources