[Kde-bindings] [Qyoto] crash when using QList returned by QMimeData.Urls

David Lechner david at lechnology.com
Tue Feb 19 06:21:37 UTC 2013


I am getting a crash when trying to access the QUrl objects returned by 
QMimeData.Urls.

Here is the stack trace of the crash

 > Program received signal SIGSEGV, Segmentation fault.
 > QMutex::lockInline (this=0x82) at 
../../include/QtCore/../../src/corelib/thread/qmutex.h:187

 > #0  QMutex::lockInline (this=0x82) at 
../../include/QtCore/../../src/corelib/thread/qmutex.h:187
 > #1  0x00007fffef6fcc38 in QMutexLocker (m=<optimized out>, 
this=0x7fffffffde40) at 
../../include/QtCore/../../src/corelib/thread/qmutex.h:109
 > #2  QUrl::isLocalFile (this=0xc2f050) at io/qurl.cpp:6332
 > #3  0x00007fffefcf63f4 in __smokeqtcore::x_QUrl::x_73 (this=0xc2f050, 
x=0xc82c10) at /home/david/obj/smokeqt/qtcore/x_18.cpp:2318
 > #4  0x00007fffefcee128 in __smokeqtcore::xcall_QUrl (xi=73, 
obj=0xc2f050, args=0xc82c10) at /home/david/obj/smokeqt/qtcore/x_18.cpp:2594
 > #5  0x00007ffff47162db in Qyoto::MethodCall::callMethod 
(this=0x7fffffffe060) at 
/home/david/dev/assemblygen/assemblies/qyoto-qtcore/native/methodcall.cpp:93
 > #6  0x00007ffff47165a6 in Qyoto::MethodCall::next 
(this=0x7fffffffe060) at 
/home/david/dev/assemblygen/assemblies/qyoto-qtcore/native/methodcall.cpp:123
 > #7  0x00007ffff471f739 in CallSmokeMethod (smoke=0xa46120, 
methodId=5374, obj=0x2b, sp=0x7ffff7fd6160, items=0, 
typeIDs=0x7ffff7fd6138) at 
/home/david/dev/assemblygen/assemblies/qyoto-qtcore/native/qyoto.cpp:318
 > #8  0x0000000040046429 in ?? ()


 From using gdb, I have determined that the QUrl reference is getting 
messed up somewhere in the QList. In the stack trace below, a QUrl was 
created at the address of 0xc2f050, but when it is returned through the 
QList<QUrl> we are getting the address 0x7fffffffdce0. But if you look, 
QUrl->d is 0xc2f050, which should the the QUrl itself. So, I am guessing 
that something is getting a bit off in the casting somewhere.

 > #0  0x00007fffef6f6ece in ref (this=0xc2f050) at 
../../include/QtCore/../../src/corelib/arch/qatomic_x86_64.h:121
 > #1  QUrl::QUrl (this=0x7fffffffdce0, other=...) at io/qurl.cpp:4263
 > #2  0x00007fffef75445c in QMimeData::setUrls (this=<optimized out>, 
urls=...) at kernel/qmimedata.cpp:336
 > #3  0x00007fffefcba25e in __smokeqtcore::x_QMimeData::x_10 
(this=0xc28980, x=0xc45740) at /home/david/obj/smokeqt/qtcore/x_11.cpp:725
 > #4  0x00007fffefcb7420 in __smokeqtcore::xcall_QMimeData (xi=10, 
obj=0xc28980, args=0xc45740) at /home/david/obj/smokeqt/qtcore/x_11.cpp:962
 > #5  0x00007ffff47162db in Qyoto::MethodCall::callMethod 
(this=0x7fffffffe040) at 
/home/david/dev/assemblygen/assemblies/qyoto-qtcore/native/methodcall.cpp:93
 > #6  0x00007ffff47165a6 in Qyoto::MethodCall::next 
(this=0x7fffffffe040) at 
/home/david/dev/assemblygen/assemblies/qyoto-qtcore/native/methodcall.cpp:123
 > #7  0x00007ffff47086d5 in marshall_ItemList<QUrl, QList<QUrl*>, 
((const char*)((char*)(& {anonymous}::QUrlListSTR)))>(Marshall *) 
(m=0x7fffffffe040) at 
/home/david/dev/assemblygen/assemblies/qyoto-qtcore/native/marshall_macros.h:52
 > #8  0x00007ffff4716558 in Qyoto::MethodCall::next 
(this=0x7fffffffe040) at 
/home/david/dev/assemblygen/assemblies/qyoto-qtcore/native/methodcall.cpp:120
 > #9  0x00007ffff471f739 in CallSmokeMethod (smoke=0xa46120, 
methodId=3722, obj=0x33, sp=0x7ffff7f6d770, items=1, 
typeIDs=0x7ffff7fd6390) at 
/home/david/dev/assemblygen/assemblies/qyoto-qtcore/native/qyoto.cpp:318
 > #10 0x0000000040046429 in ?? ()

I am stuck on where to go from here to fix this. Any advice?

I have attached the program I am using to reproduce the bug.
-------------- next part --------------
using System;
using QtCore;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;

namespace QUrlTest
{
  public static class Program
  {
    public static void Main ()
    {
      var nativeLibPath = Environment.CurrentDirectory;
      Debug.Assert (Directory.Exists (nativeLibPath));
      Environment.SetEnvironmentVariable ("LD_LIBRARY_PATH", nativeLibPath);
      var urlList = new List<QUrl> ();
      urlList.Add (new QUrl("file://~"));
      var mimedata = new QMimeData ();
      mimedata.Urls = urlList;
      foreach (var url in mimedata.Urls) {
        var isFile = url.IsLocalFile;
        Console.WriteLine (isFile);
      }
    }
  }
}



More information about the Kde-bindings mailing list