Skip to content

Conversation

@cincodenada
Copy link
Contributor

This should fix #2320 - after digging in a bit and comparing object addresses, it appeared that this was caused by a schedule_changed signal being sent to the SchedulePage from the MainWindow that is deleted in init_db.

Manually disconnecting that signal before deleting the old MainWindow resolved the error, and after trying some better options, found that simply removing the lambda and connecting the method directly (and adding an optional parameter to make it compatible with the signal's signature) also fixed the test.

I'm not very familiar with Qt6 specifically, but I suspect the lambda was causing some sort of lifetime issues, maybe the lambda itself was somehow outliving SchedulePage and preventing the signal from being deleted?

In any case, this seems like a pretty simple change that makes the tests happy on my machine.

Related Issue

#2320

Motivation and Context

I want to run the tests, still :)

How Has This Been Tested?

Ran the tests. They still succeeded.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

I think this was causing weird lifetime issues, where the lambda wasn't
getting deleted so it caused this signal to still exist after the page
was deleted
@m3nu
Copy link
Contributor

m3nu commented Dec 18, 2025

Good find! This lamda isn't necessary and neither is the pid input since the connected function doesn't use it. Changes for a full fix:

  1. src/vorta/scheduler.py:41 - Remove int parameter from signal definition
# Before
schedule_changed = QtCore.pyqtSignal(int) 

# After
schedule_changed = QtCore.pyqtSignal()
  1. src/vorta/scheduler.py - Update all 4 emit calls (lines 225, 231, 270, 359)
# Before
self.schedule_changed.emit(profile_id)

# After
self.schedule_changed.emit()
  1. src/vorta/views/schedule_page.py:64-66 - Simplify connection
# Before
self._schedule_changed_connection = self.app.scheduler.schedule_changed.connect( lambda pid: self.draw_next_scheduled_backup() ) 

#After
self._schedule_changed_connection = self.app.scheduler.schedule_changed.connect(self.draw_next_scheduled_backup)
  1. tests/unit/test_schedule.py:33 - Simplify test connection
# Before
qapp.scheduler.schedule_changed.connect(lambda *args: tab.draw_next_scheduled_backup())

# After
qapp.scheduler.schedule_changed.connect(tab.draw_next_scheduled_backup)

@m3nu
Copy link
Contributor

m3nu commented Dec 22, 2025

Replacing this by the full change: #2330

Thanks again for pointing this out!

@m3nu m3nu closed this Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scheduler_create_backup test failing on my machine

2 participants