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. QSplashScreen after startup?
Forum Updated to NodeBB v4.3 + New Features

QSplashScreen after startup?

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 707 Views 1 Watching
  • 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.
  • richferraraR Offline
    richferraraR Offline
    richferrara
    wrote on last edited by
    #1

    The documentation for QSplashScreen indicates that it is meant to be used during initialization before the main window is displayed, but is there any rule against using it afterward? I have an application that loads a format file during startup, but the user can load a different one from the user interface while the application is running. I am trying to reuse the QSplashScreen for this, but I find that when I call showMessage() on the splash screen while the main window is displayed, the application crashes.

    I am using Qt 5.15.2. The crash only happens when I am running on Windows 7. On Win 10, it seems to work okay.

    Christian EhrlicherC 1 Reply Last reply
    0
    • richferraraR richferrara

      The documentation for QSplashScreen indicates that it is meant to be used during initialization before the main window is displayed, but is there any rule against using it afterward? I have an application that loads a format file during startup, but the user can load a different one from the user interface while the application is running. I am trying to reuse the QSplashScreen for this, but I find that when I call showMessage() on the splash screen while the main window is displayed, the application crashes.

      I am using Qt 5.15.2. The crash only happens when I am running on Windows 7. On Win 10, it seems to work okay.

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You can use it anywhere and anywhen in your code. If it crashes then you most likely doing something wrong - please provide a minimal, compilable example of your problem.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      richferraraR 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        You can use it anywhere and anywhen in your code. If it crashes then you most likely doing something wrong - please provide a minimal, compilable example of your problem.

        richferraraR Offline
        richferraraR Offline
        richferrara
        wrote on last edited by
        #3

        @Christian-Ehrlicher You were right. My application connects to a radar system via Ethernet and receives data through a TCP socket. I was trying to load the data values into the display controls that were being refreshed by the routine that reloads the format file, so the controls weren't ready.

        I'm still baffled as to why this only caused the application to crash when I called showMessage() on the splash screen. I guess it was a timing issue?

        Christian EhrlicherC 1 Reply Last reply
        0
        • richferraraR richferrara

          @Christian-Ehrlicher You were right. My application connects to a radar system via Ethernet and receives data through a TCP socket. I was trying to load the data values into the display controls that were being refreshed by the routine that reloads the format file, so the controls weren't ready.

          I'm still baffled as to why this only caused the application to crash when I called showMessage() on the splash screen. I guess it was a timing issue?

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @richferrara One must look at the backtrace to really find out. My first though showMessage() spins an event loop but this is not the case. Any chance that it was called from another thread?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          richferraraR 2 Replies Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @richferrara One must look at the backtrace to really find out. My first though showMessage() spins an event loop but this is not the case. Any chance that it was called from another thread?

            richferraraR Offline
            richferraraR Offline
            richferrara
            wrote on last edited by
            #5

            @Christian-Ehrlicher I don't know. It appears I'm still having problems with it. I'm running on my desk PC that doesn't use the Ethernet connection, but it still causes the application to crash at seemingly random times. At this point I'll probably go with just implementing my own progress indicator as a widget or something else.

            1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @richferrara One must look at the backtrace to really find out. My first though showMessage() spins an event loop but this is not the case. Any chance that it was called from another thread?

              richferraraR Offline
              richferraraR Offline
              richferrara
              wrote on last edited by
              #6

              @Christian-Ehrlicher I removed the QSplashScreen and replaced it with my own dialog containing a progress bar. But now when I try updating the progress bar status while the file is loading, the application still crashes. So it's not something specific to QSplashScreen.

              Basically all I'm trying to do is:

              • The user clicks a pushbutton on the GUI to load or import a file.
              • The slot for the pushbutton shows a file dialog and allows the user to select a file.
              • The slot shows the progress screen and starts parsing the file in a loop.
              • Each time through the loop, the slot updates the progress bar value.

              That's all. But updating the progress bar is causing the application to crash, just like setting the message on the splash screen did.

              There are no other threads running in my application. I turned off the Ethernet connection also but it doesn't help.

              Pl45m4P 1 Reply Last reply
              0
              • richferraraR richferrara

                @Christian-Ehrlicher I removed the QSplashScreen and replaced it with my own dialog containing a progress bar. But now when I try updating the progress bar status while the file is loading, the application still crashes. So it's not something specific to QSplashScreen.

                Basically all I'm trying to do is:

                • The user clicks a pushbutton on the GUI to load or import a file.
                • The slot for the pushbutton shows a file dialog and allows the user to select a file.
                • The slot shows the progress screen and starts parsing the file in a loop.
                • Each time through the loop, the slot updates the progress bar value.

                That's all. But updating the progress bar is causing the application to crash, just like setting the message on the splash screen did.

                There are no other threads running in my application. I turned off the Ethernet connection also but it doesn't help.

                Pl45m4P Offline
                Pl45m4P Offline
                Pl45m4
                wrote on last edited by
                #7

                @richferrara said in QSplashScreen after startup?:

                So it's not something specific to QSplashScreen.

                It would be very unlikely since QSplashScreen is just another QWidget and unless you messed up some pointers, it should not impact your application.

                Basically all I'm trying to do is:

                The user clicks a pushbutton on the GUI to load or import a file.
                The slot for the pushbutton shows a file dialog and allows the user to select a file.
                The slot shows the progress screen and starts parsing the file in a loop.
                Each time through the loop, the slot updates the progress bar value.

                That's all. But updating the progress bar is causing the application to crash, just like setting the message on the splash screen did.

                Hard to say just from this "pseudo code" description.

                The slot shows the progress screen and starts parsing the file in a loop.

                Does it already crash on the first update call? Or does it run and update for some seconds and crashes later?
                If the former is true, check (or show) how the dialog is created and verify that the instance is still "alive" when sending the update calls. (checking how everything's connected might also help)


                If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                ~E. W. Dijkstra

                richferraraR 1 Reply Last reply
                0
                • Pl45m4P Pl45m4

                  @richferrara said in QSplashScreen after startup?:

                  So it's not something specific to QSplashScreen.

                  It would be very unlikely since QSplashScreen is just another QWidget and unless you messed up some pointers, it should not impact your application.

                  Basically all I'm trying to do is:

                  The user clicks a pushbutton on the GUI to load or import a file.
                  The slot for the pushbutton shows a file dialog and allows the user to select a file.
                  The slot shows the progress screen and starts parsing the file in a loop.
                  Each time through the loop, the slot updates the progress bar value.

                  That's all. But updating the progress bar is causing the application to crash, just like setting the message on the splash screen did.

                  Hard to say just from this "pseudo code" description.

                  The slot shows the progress screen and starts parsing the file in a loop.

                  Does it already crash on the first update call? Or does it run and update for some seconds and crashes later?
                  If the former is true, check (or show) how the dialog is created and verify that the instance is still "alive" when sending the update calls. (checking how everything's connected might also help)

                  richferraraR Offline
                  richferraraR Offline
                  richferrara
                  wrote on last edited by
                  #8

                  @Pl45m4 Never mind ... I found a memory error in my code. I think that was the problem.

                  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