Segmentation fault in QHash - qt

I got the following crash in QHash. I am unable to find any thing into. I am using Qtopia-Core-4.3.3 on Linux Machine.
The log is as follows:
ASSERT: "*node == e || (*node)->next" in file
/usr/local/Trolltech/QtopiaCore-4.3.3-400wrl/include/QtCore/qhash.h,
line 824
Segmentation fault
Can anybody help me in this?

Just a wild guess, but based on the fact that QHash is a container, and it is referring to "node", I think the given assertion is caused by the program expecting that the node is either the end node (e), or has a next node. So it appears something you are doing is messing up the entries in the hash.
To continue to speculate wildly, I have often seen some hard-to-diagnose errors when someone was iterating over a container, and sometimes removing things from the container while iterating. I don't know if QHash handles this nicely or not.

Related

LLVM front end register class error OpenCL -- GPU target

I've recently been encountering this error when compiling OpenCL kernel files with my LLVM_IR pass:
aoc: ../../../TargetRegisterInfo.cpp:89: const llvm::TargetRegisterClass* llvm::TargetRegisterInfo::getMinimalPhysRegClass(unsigned int, llvm::EVT) const: Assertion `BestRC && "Couldn't find the register class"' failed.
I'm not sure what this means. What I've read from the documention doesn't make a lot of sense. Basically it means the backend doesn't know what type to place into the register?
Does anyone know what the error means?
It occurs in various kernels and doesn't seem to have a definitive pattern I can show as an example. I can post more details if needed, but really I'd just like to know what the error is telling me.
Thanks ahead of time for any help.
UPDATE:
It seems this command in LLVM is causing the issue:
AllocaInst* llvm::IRBuilder< preserveNames, T, Inserter >::CreateAlloca(Type * Ty, Value * ArraySize = 0,const Twine & Name = "")
It creates this error when I do a nonspecific allocation in this manner. The reason I use this command is that sometimes in a kernel there will be a store value that is a Constant. Since LLVM often requires a Value I needed a way of converting it. So I do a an allocation with an immediate store and load. This was suggested by another SOF user. Does anyone know an alternate method of converting a Constant to a Value in LLVM?
Thanks all.
Ok it seems a conventional:
Value *new_val = dyn_cast<Value>(old_val);
Works perfectly fine. Hopefully this knowledge will help someone else.
UPDATE3: Scratch that. Dynamic cast doesn't convert Constant to a Value type. So if anyone knows how to do that, please let me know.
I admit I don't understand the assertion error you get. However:
The reason I use this command is that sometimes in a kernel there will be a store value that is a Constant. Since LLVM often requires a Value I needed a way of converting it. So I do a an allocation with an immediate store and load.
That doesn't make sense to me:
Any llvm::Constant is already an llvm::Value
Storing a value and then loading it back seems like an expensive nop...

Automatically disconnect after first signal emission

I am loading a web page from a file, then i replace some of the html in it:
self.template_web_page = QtWebKit.QWebPage()
self.template_web_page.mainFrame().load(QtCore.QUrl('template.html'))
def load(ok):
main_window.web_view.loadFinished.disconnect(load)
self.table_element = self.template_web_page.mainFrame().findFirstElement("#table")
self.table_element.setInnerXml(table_html)
main_window.web_view.loadFinished.connect(load)
Is there a way to connect to a signal just for one shot?
As already noted, there doesn't appear to be a better (more concise) way than this.
http://comments.gmane.org/gmane.comp.lib.qt.general/6883 suggests that such a solution is fine, although I have had issues with such a solution myself. I found that if I disconnected the slot at the start of the slot (as is done in the code in the question) and then tried to perform some GUI interactions (setting statusbar text was a problem, but not highlighting a row in a list view), I got an exception due to a NULL pointer dereference. This was with PyQt 4.6.2 for Python 2.6 for Windows. When I moved the disconnect() call to the end of the slot, the problem went away.
Apologies in advance if this is not relevant and it's just a stupid mistake I've made.

BizTalk messages overwriting each other?

I have an odd situation that has only come up in this one orchestration I'm working on.
I have a Receive message come in. I use an Expression shape and write it to a variable "xmlDoc" so I can verify what is in it. I then have a Message Assignment shape where I Load a string of XML to a variable "xmlDoc2" and assign that variable to a second message and write it out so I can verify it. I then have another Expression shape and attempt to write out the first message again and it's apparently been replaced with the second message information.
It's not in a Parallel shape, and the Message Assignment is only building the second message. Between the receive and where I'm seeing this issue, I'm doing a few Decide shapes and building other messages from the Receive message. They all work fine and don't overwrite anything (do the same processes as what I'm trying to do later.)
Anyone seen this before or see something I'm missing?
ETA: The process works a bit like this:
Send Message comes in
xmlDoc = Send Message
xmlDoc.OuterXml is written to a table
xmlDoc2 = "<root><xml></xml></root>"
Second Message = xmlDoc2
xmlDoc2.OuterXml is written to a table
xmlDoc = Send Message <-- What should happen
xmlDoc = Second Message <-- What is happening
I could not reproduce your exact problem but I got close. I think there are some implied statements in your process outline that would be critical for us to understand what's really happening. In any case, I think your BizTalk messages do not get overwritten, but that the XmlDocument variables are.
I think you may have been hit by one of the fundamental confusions a developer coming from a Java or VB6 background encounters when working with C#.
C# is a Managed Language
Please, remember that C# is a managed language, in that it uses a garbage collector to reclaim unused references to objects. The key word here is Reference.
When you write the following lines:
xmlDoc2 = "<root><xml/></root>";
SecondMessage = xmlDoc2;
Basically, you have two references to the same content. Namely, two references xmlDoc2 and SecondMessage which refer to the assigned string.
So, depending upon the code you use to "write out" the XML content of your BizTalk messages, you may be overwriting some references.
Furthermore, if this happens in the context of a Construct shape, you may be inadvertently overwriting the content of the BizTalk message itself.
A Solution?
This problem does not usually manifest itself when working with BizTalk. I personally never encountered this issue.
If you update your original question with the exact code for both Expression shapes and the Assignment shape, I'll update this response with more appropriate guidance.

Question about a QList<QStringList> in Qt

I'm using Qt 4.5 and im working with a QList<QStringList> which is a list of string list.
Now I want to replace one string inside one stringList but with it seems unusual to type. I have found the following way of doing it and was wondering if it is ok:
QList <QStringList> pDataList;
pDataList[listIndex].replace(QStringIndex, newString);
Now, I'm not worried about the syntax, but I want to know if pDataList's pointers is adjascent in memory so that it is okay to use []. Is there another way to do it?
The issue of pDataList's elements being adjacent in memory is not related to the question of whether it is ok to use operator[].
In general, QList<> does not guarantee that its elements are adjacent in memory, but it does overload operator[] to give you the element you're looking for nonetheless.
The only thing you need to worry about when doing something like this is to make sure that (pDataList.size() < listIndex). otherwise, you'll be indexing elements not in the list, triggering an exception in debug or undefined behavior in release.

Why does this code only work when I use a break point?

See code below, for some reason it only works when I put a breakpoint on line 2 (*) is there some delay? Is it starting the next line before it finishes the 2nd one?
dp.SSLCertStoreType = nsoftware.IBizPayPal.DirectpaymentSSLCertStoreTypes.sstPEMKey
*dp.SSLCertStore = My.Computer.FileSystem.ReadAllText(Server.MapPath("\cert_key_pem.txt"))
dp.SSLCertSubject = "*"
Note: The error is thrown on the 3rd line only when the breakpoint is set on the 2nd line, after releasing the break the program executes my paypal purchase via credit card.
I will post the error again I am replicating it now...
System error: Could not acquire security credentials: error 8009030E.
There it is, while it should say "Order Confirmed!" type message if working correctly.
Almost certainly a threading issue, but nobody is going to be able to answer definitively unless they're familiar with nsoftware.IBizPayPal
Sometimes you can find that breaking can mutate an object's state, due to the locals window evaluating object properties. If they have a side-effect, then all bets are off, unfortunately :( No idea whether this is happening in your case.
I have no knowledge of ASP, so just wondering aloud: Could this be due to multithreading? You know when you put a break point you sort of freeze execution of all threads, but not so in the real execution.

Resources