Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75843

UWP apps crash when backgrounded

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.12.3, 5.13.0 Beta3, 5.14
    • Fix Version/s: 5.12.4, 5.13.1, 5.14.0 Alpha
    • Component/s: Core: Other
    • Labels:
      None
    • Platform/s:
      WinRT
    • Commits:
      a96a33d993618d5326e16ffb1b5028a94ceb4af2 (qt/qtbase/5.12)

      Description

      UWP apps sometimes crash when they come to foreground (from background). The crash is caused by the fact that the variable "args" can contain NULL entries (e.g. args.at( i ) == NULL) which causes a crash in "str*cmp". The following code fixes the problem by checking the elements for NULL first:

       

      //qtmain_winrt.cpp
      
              bool quote = false;
              bool escape = false;
              for (int i = 0; i < commandLine.size(); ++i) {
                  switch (commandLine.at(i)) {
                  case '\\':
                      escape = true;
                      break;
                  case '"':
                      if (escape) {
                          escape = false;
                          break;
                      }
                      quote = !quote;
                      commandLine[i] = '\0';
                      break;
                  case ' ':
                      if (quote)
                          break;
                      commandLine[i] = '\0';
                      if (!args.isEmpty() && args.last() && args.last()[0] != '\0')
                          args.append(commandLine.data() + i + 1);
                      // fall through
                  default:
                      if (!args.isEmpty() && args.last() && args.last()[0] == '\0')
                          args.last() = commandLine.data() + i;
                      escape = false; // only quotes are escaped
                      break;
                  }
              }
      
              if (args.count() >= 2 && args.at(1) && strncmp(args.at(1), "-ServerName:", 12) == 0)
                  args.remove(1); 
      
              bool develMode = false;
              bool debugWait = false;
              for (int i = args.count() - 1; i >= 0; --i) {
      			if (!args.at(i))
      				continue;
      
                  const char *arg = args.at(i);
                  if (strcmp(arg, "-qdevel") == 0) {
                      develMode = true;
                      args.remove(i);
                  } else if (strcmp(arg, "-qdebug") == 0) {
                      debugWait = true;
                      args.remove(i);
                  }
              }
              args.append(nullptr);
      

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            owolff Oliver Wolff
            Reporter:
            DanielSt Peter Staab
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes