Hi Jan,

Thank you for your kind reply and tip. I need to update my compiler. :)

I modified the my app code by copying the class
QSafeApplication, implemented in CoreApp, to my app code.

And I forgot to report that I also added following line in my app code.

"sbConfig->setString(berry::Platform::ARG_PRELOAD_LIBRARY,
"liborg_mitk_gui_qt_ext");"

I'm sorry.

Because CoreApp and ExtApp worked in my mac, so I just modified the
different parts of my app code to them.

After posting, I tested my code again.

Without QSafeApplication, my app also worked well,

but without the line
"sbConfig->setString(berry::Platform::ARG_PRELOAD_LIBRARY,
"liborg_mitk_gui_qt_ext");", my app didn't worked.

Best Regards,

Jerry.


P.S. I attached my source code.

--------------
#include <berryStarter.h>
#include <Poco/Util/MapConfiguration.h>

#include <QApplication>
#include <QMessageBox>

class QtSafeApplication : public QApplication
{

public:

  QtSafeApplication(int& argc, char** argv) : QApplication(argc, argv)
  {}

  /**
   * Reimplement notify to catch unhandled exceptions and open an error
message.
   *
   * @param receiver
   * @param event
   * @return
   */
  bool notify(QObject* receiver, QEvent* event)
  {
    QString msg;
    try
    {
      return QApplication::notify(receiver, event);
    }
    catch (Poco::Exception& e)
    {
      msg = QString::fromStdString(e.displayText());
    }
    catch (std::exception& e)
    {
      msg = e.what();
    }
    catch (...)
    {
      msg = "Unknown exception";
    }

    QString text("An error occurred. You should save all data and quit the
program to "
                 "prevent possible data loss.\nSee the error log for
details.\n\n");
    text += msg;

    QMessageBox::critical(0, "Error", text);
    return false;
  }

};


int main(int argc, char** argv)
{
  // Create a QApplication instance first
//  QApplication myApp(argc, argv);
//  myApp.setApplicationName("JMedical");
//  myApp.setOrganizationName("KAIST");

  // Create a QApplication instance first
  QtSafeApplication qSafeApp(argc, argv);
  qSafeApp.setApplicationName("JMedical");
  qSafeApp.setOrganizationName("KAIST");

Poco::Path basePath(argv[0]);
  basePath.setFileName("");

  Poco::Path provFile(basePath);
  provFile.setFileName("JMedical.provisioning");

  Poco::Util::MapConfiguration* sbConfig(new
Poco::Util::MapConfiguration());
  sbConfig->setString(berry::Platform::ARG_PROVISIONING,
provFile.toString());
  sbConfig->setString(berry::Platform::ARG_APPLICATION,
"org.mitk.qt.extapplication");
  sbConfig->setString(berry::Platform::ARG_PRELOAD_LIBRARY,
"liborg_mitk_gui_qt_ext");

return berry::Starter::Run(argc, argv, sbConfig);

}

--------------



2012/4/3 Hering, Jan <[email protected]>

> Hi Jerry,****
>
> ** **
>
> the issue you have reported is known and currently work in progress. It is
> a problem with the gcc version which comes along with XCode and which is
> (compared to the versions available on Linux systems) outdated.  The issue
> is gone with compiler version gcc4.5 and newer. As far as I know both gcc45
> and even gcc46 are available for OS X through the MacPorts project :
> http://www.macports.org/ . ****
>
> ** **
>
> For the second remark on QSafeApplication and CoreApp, could you please
> provide more details on how you managed to solve the problem? It could be
> very helpful for fixing the issue.****
>
> ** **
>
> Best regards,****
>
> ** **
>
> Jan****
>
> ** **
>
> *Von:* Jaeil Kim [mailto:[email protected] <[email protected]>]
> *Gesendet:* Freitag, 30. März 2012 17:01
> *An:* [email protected]
> *Betreff:* [mitk-users] Running MITK-based project (by plugin generator)
> in Mac Lion****
>
> ** **
>
> Dear all,
>
> I had a problem to run a MITK based project, created by
> MITKPluginGenerator, in Mac Lion.
>
> ExtApp in MITK worked very well. And, after just compiling my app, it
> worked too.
>
> But when I tried to run my MITK based project again, it crashed with a
> message "abort trap: 6".
>
> I tried many things to solve this problem, and QSafeApplication in
> CoreApp.cpp helped finally.
>
> I'm not sure why this happened, because I had no problem in linux machine
> (Ubuntu 11.10).
>
> I'm using nightly-qt4 version of MITK(updated last week), QT 4.8.0, and
> Xcode 4.2. And I got same problem with QT 4.7.
>
> I think it needs to report this problem. And if I get information about
> this problem, it will be very helpful for my understanding.
>
> Thank you in advance.
>
> Jerry.****
>
> [image: Das Bild wurde vom Absender entfernt.]****
>
>
>
> --
> Jaeil Kim
> Computer Graphics and Visualization Laboratory
> CS Dept. Korea Advanced Institute of Science and Technology (KAIST)
> 335 Gwahak-ro, Yuseong-gu, Daejeon, 305-701, South Korea
> Tel. +82-42-350-7755, +82-10-2641-9810 ****
>



-- 
Jaeil Kim
Computer Graphics and Visualization Laboratory
CS Dept. Korea Advanced Institute of Science and Technology (KAIST)
335 Gwahak-ro, Yuseong-gu, Daejeon, 305-701, South Korea
Tel. +82-42-350-7755, +82-10-2641-9810

<<~WRD000.jpg>>

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to