Fixed segfault in QApplication::exec by copying argc and argv into ui class
also reenabled writing to the QPlainTextEdit
This commit is contained in:
parent
13f5fbf8b0
commit
65d123ce2c
4 changed files with 15 additions and 7 deletions
2
.idea/codeStyleSettings.xml
generated
2
.idea/codeStyleSettings.xml
generated
|
@ -30,6 +30,6 @@
|
||||||
</Objective-C-extensions>
|
</Objective-C-extensions>
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
|
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
14
main.cpp
14
main.cpp
|
@ -171,6 +171,8 @@ int main(int argc, char *argv[]) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui *uiInstance = new ui(argc, argv);
|
||||||
|
|
||||||
char netBuf[8192];
|
char netBuf[8192];
|
||||||
|
|
||||||
// TEMP: Retreiving test file from HTTP daemon w/ TLS
|
// TEMP: Retreiving test file from HTTP daemon w/ TLS
|
||||||
|
@ -180,7 +182,7 @@ int main(int argc, char *argv[]) {
|
||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
const PRErrorCode err = PR_GetError();
|
const PRErrorCode err = PR_GetError();
|
||||||
fprintf(stderr, "Error writing data to socket, code %d: %s\n", err, PR_ErrorToName(err));
|
fprintf(stderr, "Error writing data to socket, code %d: %s\n", err, PR_ErrorToName(err));
|
||||||
// uiInstance->mainLog->appendPlainText("Error writing data to socket, see stderr.");
|
uiInstance->mainLog->appendPlainText("Error writing data to socket, see stderr.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the response
|
// Get the response
|
||||||
|
@ -188,10 +190,10 @@ int main(int argc, char *argv[]) {
|
||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
const PRErrorCode err = PR_GetError();
|
const PRErrorCode err = PR_GetError();
|
||||||
fprintf(stderr, "Error reading data from socket, code %d: %s\n", err, PR_ErrorToName(err));
|
fprintf(stderr, "Error reading data from socket, code %d: %s\n", err, PR_ErrorToName(err));
|
||||||
// uiInstance->mainLog->appendPlainText("Error writing data from socket, see stderr.");
|
uiInstance->mainLog->appendPlainText("Error writing data from socket, see stderr.");
|
||||||
} else {
|
} else {
|
||||||
printf("%s\n", netBuf);
|
printf("%s\n", netBuf);
|
||||||
// uiInstance->mainLog->appendPlainText(netBuf);
|
uiInstance->mainLog->appendPlainText(netBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(PR_Shutdown(nssSocket, PR_SHUTDOWN_BOTH) != PR_SUCCESS) {
|
if(PR_Shutdown(nssSocket, PR_SHUTDOWN_BOTH) != PR_SUCCESS) {
|
||||||
|
@ -204,9 +206,11 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
char messageBuf[1024];
|
char messageBuf[1024];
|
||||||
sprintf(messageBuf, "Found IP Address: %s", ipString);
|
sprintf(messageBuf, "Found IP Address: %s", ipString);
|
||||||
// uiInstance->mainLog->appendPlainText(messageBuf);
|
uiInstance->mainLog->appendPlainText(messageBuf);
|
||||||
|
|
||||||
|
fprintf(stderr, "argc = %d, strlen(argv[0]) = %d\n", argc, (int)strlen(argv[0]));
|
||||||
|
|
||||||
|
|
||||||
ui *uiInstance = new ui(argc, argv);
|
|
||||||
int qAppRetCode = uiInstance->exec();
|
int qAppRetCode = uiInstance->exec();
|
||||||
|
|
||||||
// Shutdown of NSS
|
// Shutdown of NSS
|
||||||
|
|
4
ui.cpp
4
ui.cpp
|
@ -1,7 +1,9 @@
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
|
||||||
ui::ui(int argc, char **argv) {
|
ui::ui(int argc, char **argv) {
|
||||||
app = new QApplication(argc, argv);
|
this->argc = argc;
|
||||||
|
this->argv = argv;
|
||||||
|
app = new QApplication(this->argc, this->argv);
|
||||||
mainWindow = new QWidget();
|
mainWindow = new QWidget();
|
||||||
mainWindow->resize(1280, 720);
|
mainWindow->resize(1280, 720);
|
||||||
mainWindow->setWindowTitle("oksirc - early Qt test");
|
mainWindow->setWindowTitle("oksirc - early Qt test");
|
||||||
|
|
2
ui.h
2
ui.h
|
@ -7,6 +7,8 @@ class ui : public QObject {
|
||||||
public:
|
public:
|
||||||
ui(int, char **);
|
ui(int, char **);
|
||||||
|
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
int exec();
|
int exec();
|
||||||
void sendButtonClicked(bool);
|
void sendButtonClicked(bool);
|
||||||
void returnOnTextEntry();
|
void returnOnTextEntry();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue