Hi,

hope this is an adequate mailing list for this quesion, appologies in
advance if not.

I'm trying to embed python into a C++/Qt application using boost
python. This works pretty well except the whole program crashes when a
pyqt slot is invoked that takes a QString as its parameter.
This is a minimal example:

#include <QCoreApplication>
#include <boost/python.hpp>

using namespace boost::python;

bool handled_exec_file(str filename, object globals) {
  return handle_exception(boost::bind(exec_file, filename, globals, object()));
}

int main() {
  QCoreApplication a(argc, argv);
  Py_Initialize();

  object main_module = import("__main__");
  object main_namespace = main_module.attr("__dict__");

  if (handled_exec_file("test.py", main_namespace)) {
    if (PyErr_Occurred()) {
      PyErr_Print();
    } else {
      qCritical("unknown error in python code");
    }
  }
  return a.exec();
}

-------------------------

from PyQt4 import QtGui

def editBoxChanged(text):
    pass

app = QtGui.QApplication([])
widget = QtGui.QWidget()

editBox = QtGui.QLineEdit(widget)
editBox.textEdited.connect(editBoxChanged)  # mark

widget.show()
app.exec_()


This crashes the second I enter something in the line-edit (exception
code c0000005). If I run this in a debugger I get
"Invalid address specified to RtlFreeHeap( 00BD0000, 00CF8798 )
(1684.1f88): WOW64 breakpoint - code 4000001f (first chance)"
instead every time I input a character.

The crash doesn't happen if the marked python line is removed.

Does anyone have an idea what might be causing this or how to further
debug the issue?

I'd appreciate any help.
Sebastian
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to