Hello all,
I have noticed some strange behavior in my app. So here is a quick summary of what i'm doing:
- I have a non-QT app (Photoshop).
- I'm creating a plugin which has to use Threading and Widgets (So i need a QApplication instance).
- Photoshop starts the application several times without "freeing" static data...
- In the main plugin method, i do like this:
bool bUserAccepted = false;
{
ILogger::Log(LOGLEVEL_DEBUG, "Now starting the GUI...");
try {
// Initialize the QT engine.
int iArgC = 0;
CWndMainImpl cMainWin((HWND)((PlatformData*)gFilterRecord->platformData)->hwnd, pInPlane, pOutPlane);
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
cMainWin.show();
app.exec();
bUserAccepted = cMainWin.bAccepted;
} catch(...) {
throw CGenericEx("Unable to display the GUI.", __FILE__, __LINE__);
}
}
bool bUserAccepted = false;
{
ILogger::Log(LOGLEVEL_DEBUG, "Now starting the GUI...");
try {
// Initialize the QT engine.
int iArgC = 0;
static QApplication app (iArgC, NULL);
CWndMainImpl cMainWin((HWND)((PlatformData*)gFilterRecord->platformData)->hwnd, pInPlane, pOutPlane);
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
cMainWin.show();
app.exec();
bUserAccepted = cMainWin.bAccepted;
} catch(...) {
throw CGenericEx("Unable to display the GUI.", __FILE__, __LINE__);
}
}
To copy to clipboard, switch view to plain text mode
I'm not getting any exception, at least at the begining. But after some times without restarting Photoshop, i'm getting some random errors... Sometimes Photoshop just crash, sometimes i get an unknown exception thrown out. So i'm wondering, can it be some static data QApplication allocates, which are supposed to be only allocated once? Maybe i'm doing something wrong with the connect slot to quit, what do you suggest?
Thanks for your answers ^^
Pierre.
Bookmarks