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. [SOLVED] Application crashes on clipboard copy or cut (but not paste)
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Application crashes on clipboard copy or cut (but not paste)

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 2.8k 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.
  • C Offline
    C Offline
    copperfield81
    wrote on last edited by
    #1

    An application I am developing crashes when either cut or copy is used, yet somehow paste is not affected.

    UPDATE It occurs when using QInputDialog::getText(...), but not for QInputDialog::getMultiLineText(...).

    It does not crash on my development machine (windows 7, Qt 5), however it does on my other PC (windows 7, Qt 5). Unfortunately the crash information is very limited, right after cut or copy is issued, a window pops up saying 'A problem caused the program to stop working correctly. Please close the program.'.
    Oddly enough it does not happen with other apps I've developed, even though they use the same call to QInputDialog::getText(...).

    Any ideas on what could cause the crashing?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maximus
      wrote on last edited by
      #2

      Just curious, why are you using QInputDialog::getText to copy?

      I'm my qt apps, I don't code anything and copy/pasting from a field to another works out of the box with Qt?


      Free Indoor Cycling Software - https://maximumtrainer.com

      1 Reply Last reply
      0
      • C Offline
        C Offline
        copperfield81
        wrote on last edited by
        #3

        I wasn't using QInputDialog::getText(...) to copy, its the QInputDialog convenience function to get a single line of text (ie. it pops-up a dialog box with a QLineEdit).

        1 Reply Last reply
        0
        • M Offline
          M Offline
          maximus
          wrote on last edited by
          #4

          Oh I see, never used this before.

          So it crash as soon as you copy some text inside the QInputDialog?
          Fast like that.. I'm thinking maybe string encoding problem?
          does it crash on every input you paste ?


          Free Indoor Cycling Software - https://maximumtrainer.com

          1 Reply Last reply
          0
          • C Offline
            C Offline
            copperfield81
            wrote on last edited by
            #5

            Found the solution... the problem was an error in my QThread.
            It uses QAxObject to communicate with Excel.

            Anyway, on starting the thread 'run()' I called 'CoInitialize(NULL)', and then for simplicity I had a call to 'CoUninitialize()' in the thread destructor.
            Once I moved the 'CoUnitialize()' call to the 'run()' function (at every exit point), everything works fine.

            Strange how it only seemed to mess with the clipboard.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              maximus
              wrote on last edited by
              #6

              Great that you found it :) good luck!


              Free Indoor Cycling Software - https://maximumtrainer.com

              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