QMessageBox closes application
-
@LeLev said in connect() keeps crashing:
connect(this, &MyClass::customContextMenuRequested, this, &MyClass::showContextMenu);
I tried this, but it still doesn't come back from the showContextMenu. I inserted a qDebug() at the end of showContextMenu and that one does show up in the debugger, but the qDebug() i've put after the connect() doesn't show up in the debugger.
-
@LeLev said in connect() keeps crashing:
connect(this, &MyClass::customContextMenuRequested, this, &MyClass::showContextMenu);
I tried this, but it still doesn't come back from the showContextMenu. I inserted a qDebug() at the end of showContextMenu and that one does show up in the debugger, but the qDebug() i've put after the connect() doesn't show up in the debugger.
@hobbyProgrammer
There is something very odd here. If it genuinely does not execute the line after theconnect()
as you say, then (presumably) the connection would not be made so the slot would never be called and you would not seeshowContextMenu()
being called. Have a look again at your code/debug output, use a debugger breakpoint, etc. -
@LeLev said in connect() keeps crashing:
connect(this, &MyClass::customContextMenuRequested, this, &MyClass::showContextMenu);
I tried this, but it still doesn't come back from the showContextMenu. I inserted a qDebug() at the end of showContextMenu and that one does show up in the debugger, but the qDebug() i've put after the connect() doesn't show up in the debugger.
@hobbyProgrammer Then please show showContextMenu code or a stack trace, else we can only guess...
The thing is: connect() does not call showContextMenu, it just connects the signal to the slot. -
@hobbyProgrammer Then please show showContextMenu code or a stack trace, else we can only guess...
The thing is: connect() does not call showContextMenu, it just connects the signal to the slot.@jsulm It seems to print the qDebug() line before executing the connect(). And the app closes in the qeventloop.cpp.
while (!d->exit.loadAcquire()) processEvents(flags | WaitForMoreEvents | EventLoopExec);
I have no idea why it stops there.
-
@jsulm it also stops whenever I save a file. The saving part works perfectly, but afterwards it just closes down the app and it seems to be the same mystery as the showContextMenu.
I would like to think that it's the connect function, since they both use connect().
However I've connected about 20 actions like this and only 2 seems to close the app. I would expect them all to close down the app if it were the connect() function. -
@jsulm it also stops whenever I save a file. The saving part works perfectly, but afterwards it just closes down the app and it seems to be the same mystery as the showContextMenu.
I would like to think that it's the connect function, since they both use connect().
However I've connected about 20 actions like this and only 2 seems to close the app. I would expect them all to close down the app if it were the connect() function.@hobbyProgrammer As I said: connect() does not call the slots.
Why don't you simply use debugger to see where exactly it crashes? -
@hobbyProgrammer As I said: connect() does not call the slots.
Why don't you simply use debugger to see where exactly it crashes?@jsulm As I said:
it closes/crashes in the qeventloop.cpp.while (!d->exit.loadAcquire()) processEvents(flags | WaitForMoreEvents | EventLoopExec);
But I have no clue how to prevent this
-
@jsulm As I said:
it closes/crashes in the qeventloop.cpp.while (!d->exit.loadAcquire()) processEvents(flags | WaitForMoreEvents | EventLoopExec);
But I have no clue how to prevent this
-
@hobbyProgrammer Does it crash if you do not connect the slot?
And it would be helpful if you would post the stack trace after crash. -
@hobbyProgrammer said in connect() keeps crashing:
Whenever I use the debugger I don't even get the showContexyMenu(),
So what's the backtrace?
-
I'm not really familliar with the debugger... Does this provide the information you need?
-
I'm not really familliar with the debugger... Does this provide the information you need?
@hobbyProgrammer If you post screen shots you should at least make sure the function signature on the bottom-right side are readable...
-
@hobbyProgrammer If you post screen shots you should at least make sure the function signature on the bottom-right side are readable...
@jsulm
is this better?
-
@jsulm
is this better?
@hobbyProgrammer
It would be better if we could read the full function signatures at the bottom right, instead of left-truncated! Can't you drag the column resizer so we can see the full function name? You can make columns like Condition or Ignore much smaller. -
This post is deleted!
@hobbyProgrammer said in connect() keeps crashing:
qv.at(i)
It looks like you've created your vector on stack. What exactly does your slot do? Which vars do you access / try to access there?
If the connection fails, you would get an explicit warning / error message (which is obviously not the case)I'm sure, that it crashes because you did something wrong before or inside your slot function.
-
@hobbyProgrammer said in connect() keeps crashing:
qv.at(i)
It looks like you've created your vector on stack. What exactly does your slot do? Which vars do you access / try to access there?
If the connection fails, you would get an explicit warning / error message (which is obviously not the case)I'm sure, that it crashes because you did something wrong before or inside your slot function.
@Pl45m4 Hi, I've found why it closes the app (sort of).
I have a few screens before this one. After going through those screens, you'll end up at this screen.
Whenever I only open this screen, it works perfectly, but when I open the screen through a different screen, it closes after a certain action.
Those other screens are hidden whenever a new screen is shown.I still don't know why it closes.
-
@Pl45m4 Hi, I've found why it closes the app (sort of).
I have a few screens before this one. After going through those screens, you'll end up at this screen.
Whenever I only open this screen, it works perfectly, but when I open the screen through a different screen, it closes after a certain action.
Those other screens are hidden whenever a new screen is shown.I still don't know why it closes.
@hobbyProgrammer said in connect() keeps crashing:
I've found why it closes the app (sort of).
@hobbyProgrammer said in connect() keeps crashing:
I still don't know why it closes
Hm.... :D
@hobbyProgrammer said in connect() keeps crashing:
I have a few screens before this one
What kind of screens? You mean, if you are doing something, then it works but if you do something else (different action), then it crashes?
YOU programmed it, so you must know (should know) best, WHAT you did ;-)
Anybody else can just guess, if you make vague descriptions...What does the "crash" look like? Any exception / error message or is it just terminating your process?
-
@hobbyProgrammer said in connect() keeps crashing:
I've found why it closes the app (sort of).
@hobbyProgrammer said in connect() keeps crashing:
I still don't know why it closes
Hm.... :D
@hobbyProgrammer said in connect() keeps crashing:
I have a few screens before this one
What kind of screens? You mean, if you are doing something, then it works but if you do something else (different action), then it crashes?
YOU programmed it, so you must know (should know) best, WHAT you did ;-)
Anybody else can just guess, if you make vague descriptions...What does the "crash" look like? Any exception / error message or is it just terminating your process?
@Pl45m4 No there's a screen with a "start" button and when you press that button, the graphicsview screen shows up. When I remove that screen it works, but I need that screen/window for the end result.
The way I call a new screen is like this:
In the .h file:
#include "window.h" private: Window *win;
In the .cpp file:
this->hide(); //hides the current screen win = new Window(this); win->show();
-
@hobbyProgrammer said in connect() keeps crashing:
I've found why it closes the app (sort of).
@hobbyProgrammer said in connect() keeps crashing:
I still don't know why it closes
Hm.... :D
@hobbyProgrammer said in connect() keeps crashing:
I have a few screens before this one
What kind of screens? You mean, if you are doing something, then it works but if you do something else (different action), then it crashes?
YOU programmed it, so you must know (should know) best, WHAT you did ;-)
Anybody else can just guess, if you make vague descriptions...What does the "crash" look like? Any exception / error message or is it just terminating your process?
@Pl45m4 Hi, the crash is not actually a crash. It's just the app that closes. It comes with an "exited with code 0"