-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ccGuiPythonInstance.cpp and prevent crash #122
base: master
Are you sure you want to change the base?
Conversation
Do you have an example that triggers the crash ? |
Sorry about the missing information. And also, I am not sure if it is the evidence that I have found other people having met the same problem (refer this commit) There might be three occasions,
import pycc, cccorelib
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QEventLoop, pyqtSignal, QCoreApplication, pyqtSlot
from PyQt5.QtWidgets import (
QLabel,
QWidget,
QVBoxLayout,
QPushButton,
QHBoxLayout,
QMessageBox,
)
cc = pycc.GetInstance()
class MainWindow(QWidget):
def __init__(self):
super().__init__()
self.init_ui()
def init_ui(self):
self.layout = QVBoxLayout()
self.setLayout(self.layout)
self.button = QPushButton("removeFromDB")
self.button.clicked.connect(self.on_button_click)
self.layout.addWidget(self.button)
def closeEvent(self, event):
event.accept() # Close the window
self.event_loop.quit()
@pyqtSlot()
def on_button_click(self):
a = cc.getSelectedEntities()[0]
# b = a.getScalarField(a.getScalarFieldIndexByName("Instance_ID")).asArray()
ref_pcd = cccorelib.ReferenceCloud(a)
for idx in range(a.size()):
ref_pcd.addPointIndex(idx)
selected = a.partialClone(ref_pcd)
selected.setName('aaa')
cc.addToDB(selected)
cc.removeFromDB(a)
def _create_app_and_run():
plugin_widget = MainWindow()
plugin_widget.setWindowTitle("SBASE annotator")
loop = QEventLoop()
plugin_widget.show()
plugin_widget.event_loop = loop
cc.freezeUI(False)
cc.updateUI()
loop.exec_()
_create_app_and_run()``` |
Speaking of which, I found that the I am not sure what happened, while I am planning to debug it in the next month if I had time. |
After experiements, However, the compiled version of cloudcompare and pybind11 worked fine. |
Hi. Thanks for the report. I update the beta channel of the flatpack on flathub. could you please give a try and tell me if it fixes your issue (at least for the py::array_t) ? thanks. |
I'm not quite sure removeFromDB is the problem, I have not run the full code you sent, onlye the a = cc.getSelectedEntities()[0]
# b = a.getScalarField(a.getScalarFieldIndexByName("Instance_ID")).asArray()
ref_pcd = cccorelib.ReferenceCloud(a)
for idx in range(a.size()):
ref_pcd.addPointIndex(idx)
selected = a.partialClone(ref_pcd)
selected.setName('aaa')
cc.addToDB(selected)
cc.removeFromDB(a) part. Also, the change proposed is not really a fix since it creates a memory leak I'll try running the full example to see if it changes anything |
Sometimes,
removefromdb
causes the Python plugin and CC software to crash.Ubuntu 22.04
Python 3.11
After modification, the user can also use Python objects.