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: crash on exit on Win might be prevented by app.clipboard().dataChanged.disconnect()
QtWS25 Last Chance

Solved: crash on exit on Win might be prevented by app.clipboard().dataChanged.disconnect()

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.0k 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.
  • B Offline
    B Offline
    bootchk
    wrote on last edited by
    #1

    For the benefit of others, a mistake of mine, that might be common.

    In my app, I connected clipboard().dataChanged to an app slot that enables a paste action owned by the menubar of the main window. Without disconnecting that signal, if the user had copied something to the clipboard, my app crashed on exit, on the Win platform (but not OSX or Linux?). Calling clipboard().dataChanged.disconnect() in a handler for aboutToQuit signal seems to fix it. I surmise that at least on the Win platform, the signal is emitted while the app is quitting/exiting, after the main window (that my signal handler is enabling) was already deleted. (It is strange that the signal is emitted at that time, since the clipboard data had actually NOT changed at that time. I suppose it is a quirk of the Win Vista platform.)

    I connected dataChanged to a slot in the app object, but the slot accessed the main window object. I suppose if I had connected dataChanged to a slot in the main window object, when main window was deleted, Qt would have automatically disconnected.

    I'm using PyQt. The crash occurred in the Python interpreter (python27.dll). I think the mistake is also relevant to C++ apps.

    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