Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QCoreApplication::instance() returning NULL
Forum Updated to NodeBB v4.3 + New Features

QCoreApplication::instance() returning NULL

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PaulOfford
    wrote on last edited by
    #1

    I am developing a plugin for an Qt application called Wireshark. The plugin is built into a Windows DLL that is detected at Wireshark startup time.

    I want to reference the QCoreApplication in the DLL. I've tried using QCoreApplication::instance() but it return a NULL pointer.

    The main application class is defined like this:

    class WiresharkApplication : public QApplication
    {
        Q_OBJECT
    public:
        explicit WiresharkApplication(int &argc,  char **argv);
    .
    .
    

    And it's instantiated in main.

    I've read that there is a problem with QCoreApplication::instance() and release and debug builds - see http://www.qtcentre.org/archive/index.php/t-45574.html

    Is this an actual problem?

    I'm using Visual Studio 2013 to develop the code.

    Thanks and regards...Paul

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      In fact this should not give the problem. It should return the right value object value. It does not matter from where you are calling. I have used this many times on linux and Mac, It works fine. I'm sure this will not help you. Can I send my simple plugin and app code which you can check ? Hope your plugin and exe are either in release or debug mode and NOT criss-crossed.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      P 1 Reply Last reply
      4
      • dheerendraD dheerendra

        In fact this should not give the problem. It should return the right value object value. It does not matter from where you are calling. I have used this many times on linux and Mac, It works fine. I'm sure this will not help you. Can I send my simple plugin and app code which you can check ? Hope your plugin and exe are either in release or debug mode and NOT criss-crossed.

        P Offline
        P Offline
        PaulOfford
        wrote on last edited by
        #3

        @dheerendra Hi - I might take you up on the offer of trying your code but let me try to fix what I have first. The build process for Wireshark is extremely complex and so I think I should check that I have criss crossed the build and debug status.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved