Inherited QGuiApplication object do not working on iOS Simulator. Why?
-
Hello all!
Just got strange thing. The very simple class inherited from QGuiApplication do not working on iOS Simulator only. When I run it on Simulator it's starting and closing. Without any error message. When on iOS device everything fine. The same for desktop and Android - everything OK. The message that I see in iOS Simulator:18:06:47: Starting remote process. QML debugging is enabled. Only use this in a safe environment. 18:06:49: Run ended.
Nothing more than it.
The class is very simple:
- class CustomGuiApplication.cpp
CustomGuiApplication::CustomGuiApplication(int inCounter,char *inArguments[]) : QGuiApplication(inCounter,inArguments) {} CustomGuiApplication::~CustomGuiApplication(void) {}
- header CustomGuiApplication.h
CustomGuiApplication : public QGuiApplication { public: explicit CustomGuiApplication(int inCounter,char *inArguments[]); virtual ~CustomGuiApplication(void); };
When I am using pure QGuiApplication all is OK. It's happening only if I am inheriting class and only on Simulator.
Is it bug??? -
Hi,
Without knowing what you are doing in your custom class it's impossible to answer.
-
Hello all!
Just got strange thing. The very simple class inherited from QGuiApplication do not working on iOS Simulator only. When I run it on Simulator it's starting and closing. Without any error message. When on iOS device everything fine. The same for desktop and Android - everything OK. The message that I see in iOS Simulator:18:06:47: Starting remote process. QML debugging is enabled. Only use this in a safe environment. 18:06:49: Run ended.
Nothing more than it.
The class is very simple:
- class CustomGuiApplication.cpp
CustomGuiApplication::CustomGuiApplication(int inCounter,char *inArguments[]) : QGuiApplication(inCounter,inArguments) {} CustomGuiApplication::~CustomGuiApplication(void) {}
- header CustomGuiApplication.h
CustomGuiApplication : public QGuiApplication { public: explicit CustomGuiApplication(int inCounter,char *inArguments[]); virtual ~CustomGuiApplication(void); };
When I am using pure QGuiApplication all is OK. It's happening only if I am inheriting class and only on Simulator.
Is it bug??? -
@bogong Did you try to debug on simulator? Stack trace could provide more information about what is happening.
-
I've been wrong in previous message. Just reinstalled on Qt 5.12.5 and Xcode 10.3 from scratch on clean and totally erased MacBook. The same result it's not working only on iOS Simulator. When I ran it in XCode directly - got this error:
Why it might be only in iOS simulator? Every other platform working perfectly.
-
Hello all!
Just got strange thing. The very simple class inherited from QGuiApplication do not working on iOS Simulator only. When I run it on Simulator it's starting and closing. Without any error message. When on iOS device everything fine. The same for desktop and Android - everything OK. The message that I see in iOS Simulator:18:06:47: Starting remote process. QML debugging is enabled. Only use this in a safe environment. 18:06:49: Run ended.
Nothing more than it.
The class is very simple:
- class CustomGuiApplication.cpp
CustomGuiApplication::CustomGuiApplication(int inCounter,char *inArguments[]) : QGuiApplication(inCounter,inArguments) {} CustomGuiApplication::~CustomGuiApplication(void) {}
- header CustomGuiApplication.h
CustomGuiApplication : public QGuiApplication { public: explicit CustomGuiApplication(int inCounter,char *inArguments[]); virtual ~CustomGuiApplication(void); };
When I am using pure QGuiApplication all is OK. It's happening only if I am inheriting class and only on Simulator.
Is it bug???@bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:
CustomGuiApplication::CustomGuiApplication(int inCounter,char *inArguments[]) : QGuiApplication(inCounter, inArguments) { }
is wrong. The argc must be passed by reference, not by value. Also a friendly piece of advice - don't inherit from
QXXXApplication
for no good reason at all ... -
@bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:
CustomGuiApplication::CustomGuiApplication(int inCounter,char *inArguments[]) : QGuiApplication(inCounter, inArguments) { }
is wrong. The argc must be passed by reference, not by value. Also a friendly piece of advice - don't inherit from
QXXXApplication
for no good reason at all ...@kshegunov ??? But why it's working everywhere else but not in iOS Simulator only??? And why it's working on 5.12.4 but not in Qt 5.12.5 and 5.13.1??? Why do the error looks like architecture trouble but not application??? Why has it been working at least for 5 applications since 2014???
-
@kshegunov ??? But why it's working everywhere else but not in iOS Simulator only??? And why it's working on 5.12.4 but not in Qt 5.12.5 and 5.13.1??? Why do the error looks like architecture trouble but not application??? Why has it been working at least for 5 applications since 2014???
Are we arguing now?
But why it's working everywhere else but not in iOS Simulator only???
Even if it worked on every other platform beside X, then it's not working, exactly because it doesn't work on X. You can't have it both ways, it either works, or it doesn't. If it works then it works everywhere, if it's broke sometimes then it doesn't work.
Why do the error looks like architecture trouble but not application???
Oh, no, it's user-code error.
Compare signatures: https://doc.qt.io/qt-5/qcoreapplication.html#QCoreApplication -
Are we arguing now?
But why it's working everywhere else but not in iOS Simulator only???
Even if it worked on every other platform beside X, then it's not working, exactly because it doesn't work on X. You can't have it both ways, it either works, or it doesn't. If it works then it works everywhere, if it's broke sometimes then it doesn't work.
Why do the error looks like architecture trouble but not application???
Oh, no, it's user-code error.
Compare signatures: https://doc.qt.io/qt-5/qcoreapplication.html#QCoreApplication@kshegunov This *inArguments[] totally equal **inArguments ... It was BTW ... And it's working on Linux, Windows, MacOS and iOS device but not on iOS Simulator only ...
-
@kshegunov This *inArguments[] totally equal **inArguments ... It was BTW ... And it's working on Linux, Windows, MacOS and iOS device but not on iOS Simulator only ...
@bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:
This *inArguments[] totally equal **inArguments
Yes, the former decays to the latter, but as I said originally
int &
is very different fromint
. -
@bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:
This *inArguments[] totally equal **inArguments
Yes, the former decays to the latter, but as I said originally
int &
is very different fromint
.@kshegunov And how it explain that is not working on iOS Simulator only??? Is there special C++ syntax for iOS Simulator??? I mean if I am wrong - OK, but why it's crashing on iOS Simulator only but not everywhere?
-
@kshegunov And how it explain that is not working on iOS Simulator only??? Is there special C++ syntax for iOS Simulator??? I mean if I am wrong - OK, but why it's crashing on iOS Simulator only but not everywhere?
@bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:
And how it explain that is not working on iOS Simulator only???
You've been relying on an implementation detail (and possibly undefined behavior).
Let me put this into an example:static SomeClass global1 = SomeClass(0); static OtherClass global2 = OtherClass(global1); int main(...) { ... }
Seems legit, right? Well it's not, the moment
global2
touchesglobal1
you're in undefined behavior land. The order of (nontrivial) statics intialization is undefined. So even if it works on 100 different platforms, it's still broke, and when the 101st actually breaks it, you don't say - "well it worked 100 times, so there's something wrong with 101st", you say "damn, I had the rotten luck of it working 100 times before it showed its ugly fangs and horns".[1]Is there special C++ syntax for iOS Simulator???
Of course not, but you've not satisfied the requirements put forward by the framework - that is you've passed a local copy instead of the original variable holding the number of arguments.
[1]: https://en.wikipedia.org/wiki/Thirteenth_stroke_of_the_clock
-
@bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:
And how it explain that is not working on iOS Simulator only???
You've been relying on an implementation detail (and possibly undefined behavior).
Let me put this into an example:static SomeClass global1 = SomeClass(0); static OtherClass global2 = OtherClass(global1); int main(...) { ... }
Seems legit, right? Well it's not, the moment
global2
touchesglobal1
you're in undefined behavior land. The order of (nontrivial) statics intialization is undefined. So even if it works on 100 different platforms, it's still broke, and when the 101st actually breaks it, you don't say - "well it worked 100 times, so there's something wrong with 101st", you say "damn, I had the rotten luck of it working 100 times before it showed its ugly fangs and horns".[1]Is there special C++ syntax for iOS Simulator???
Of course not, but you've not satisfied the requirements put forward by the framework - that is you've passed a local copy instead of the original variable holding the number of arguments.
[1]: https://en.wikipedia.org/wiki/Thirteenth_stroke_of_the_clock
@kshegunov I mean if I am wrong - OK, but why it's crashing on iOS Simulator ONLY but not everywhere? In following your explanation it should be crashing everywhere but it's not.
-
@kshegunov I mean if I am wrong - OK, but why it's crashing on iOS Simulator ONLY but not everywhere? In following your explanation it should be crashing everywhere but it's not.
@bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:
@kshegunov I mean if I am wrong - OK
You're wrong. But don't feel bad, we all are wrong, all the time.
but why it's crashing on iOS Simulator ONLY but not everywhere? In following your explanation it should be crashing everywhere but it's not.
I believe I've already answered this. Perhaps you should read my explanation again.
-
@kshegunov I mean if I am wrong - OK, but why it's crashing on iOS Simulator ONLY but not everywhere? In following your explanation it should be crashing everywhere but it's not.
@bogong said in Inherited QGuiApplication object do not working on iOS Simulator. Why?:
@kshegunov I mean if I am wrong - OK, but why it's crashing on iOS Simulator ONLY but not everywhere? In following your explanation it should be crashing everywhere but it's not.
That's an example of "undefined behaviour".