Has anyone an idea why I am getting this crash? Could it be, that the previewfile is locked or something?
I’m dynamically adding a QLPreviewViewControlMBS control to a ContainerControl. It seems to work, but when I try to assign a file for preview to it, then it crashes the app completely. The keyword in the crashlog seems to be: blockingUntilLoading, but I’m stuck with that.
[quote]4 com.apple.QuickLookFramework 0x02f36399 _QLCrash + 222
5 com.apple.QuickLookFramework 0x02f3644b _QLRaiseAssert + 178
6 com.apple.QuickLookUIFramework 0x02cf6f1b -[QLPreviewView setPreviewItem:blockingUntilLoading:timeoutDate:transition:] + 208
7 com.apple.QuickLookUIFramework 0x02cf6e45 -[QLPreviewView setPreviewItem:blockingUntilLoading:timeoutDate:] + 64
8 com.apple.QuickLookUIFramework 0x02cf6dff -[QLPreviewView setPreviewItem:blockingUntilLoading:] + 57
9 com.apple.QuickLookUIFramework 0x02cf6dc1 -[QLPreviewView setPreviewItem:] + 48
10 MBS Xojo SnowLeopard Plugin.xojo_plugin_6.dylib 0x0c367f12 setpreviewItem(REALobjectStruct*, REALfolderItemStruct*) + 354
11 com.osswald.pro.seminar 0x006cca60 QLPreviewViewMBS.=previewItem%%oo + 86
[/quote]
The complete log could be downloaded from here:
http://osswald.com/xojo/mbs/preview/crashlog.zip
I have a working proof-of-concept app, where I dynamically create a QLPreviewControlMBS and use it:
http://osswald.com/xojo/mbs/preview/qlpreview.zip
So in tests it works, but in my actual app it crashes.
From a XojoScript, I try to access a listbox “filebox”, get a file from it and set the file to the previewitem of the QLPreviewViewControlMBS.
Setting it to Nil does not crash:
pv.n.previewItem=Nil
Setting it to an existing file does crash the app:
pv.n.previewItem=f
The XojoScript context method looks like this:
[code]Protected Sub SetPreview(FileboxName As String, PreviewName As String)
Dim fb As imFilebox = WindowMain.imFB(FileboxName)
If fb = Nil Then Return
Dim pv As imPreview = WindowMain.imPR(PreviewName)
If pv = Nil Then Return
// Clear Preview
pv.n.previewItem=Nil
Try
If fb.ListCount > 0 Then
Dim idx As Integer = fb.ListIndex
If idx >= 0 Then
If fb.RowTag(idx) <> Nil Then
Dim f As FolderItem = fb.RowTag(idx)
If f <> Nil And f.Exists Then
// Set preview file
pv.n.previewItem=f // <<<=== Crashes here
End If
End If
End If
End If
Catch
// …
End Try
End Sub
[/code]