Cristina1986
Cristina1986

Reputation: 525

QApplication The program has unexpectedly finished

I created my project with OpenCV and QT libraries. In my project, I show to my webcam a Marker (using aruco); when cam recognize it, a browser is created (with Qt library) and a site is shown. (you can see it in this image) enter image description here

But, when I close the browser and i show the marker to cam again (I don't close my project), my program stops unexpectedly enter image description here

I work on Win7 x64 with QtCreator 2.6.0 e qt 4.8.3 library. I think problem is the QApplication. it seems that does not close completely.

this is the code of browser's creation (QApplication's creation):

   int browser(int argc, char **argv)
{
    Q_INIT_RESOURCE(data);
    BrowserApplication application(argc, argv);
    if (!application.isTheOnlyBrowser())
        return 0;
    application.newMainWindow();
   return application.exec();

}

Anyone have any ideas or know how to fix it???

Thanks!

Upvotes: 1

Views: 689

Answers (1)

Luca Carlon
Luca Carlon

Reputation: 9986

It is my understanding you have one application with at least two windows (one for the camera and one for the browser) and I suspect BrowserApplication is subclassing QApplication. Is this correct? If I'm correct, then read the first few lines of the QApplication class description:

For any GUI application using Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any given time.

You're not providing the implementation of BrowserApplication but I suspect you're creating two instances.

Upvotes: 1

Related Questions