https://bugs.kde.org/show_bug.cgi?id=443248
Bug ID: 443248 Summary: Notifier class not properly initialized Product: krita Version: 5.0.0-beta1 Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: Scripting Assignee: krita-bugs-n...@kde.org Reporter: grum...@grum.fr Target Milestone: --- SUMMARY In setup() method of a plugin called at Krita's startup: """ def setup(self): def windowCreated(): print('windowCreated!') print("Notifier active: ", Krita.instance().notifier().active()) Krita.instance().notifier().windowCreated.connect(windowCreated) """ In terminal we have: """ Notifier active: False windowCreated! """ That's not consistent: if notifier is not active, signal should not be emitted in window is created. An explicit call to """Krita.instance().notifier().setActive(False)""" fix the problem. STEPS TO REPRODUCE 1. Create a basic plugin 2. Edit setup() method to connect a signal for "windowCreated" 3. Execute Krita OBSERVED RESULT Even if notifier indicate it's not active, notifier signals are emitted EXPECTED RESULT The notifier should be properly initialized. There's 2 possibilities: 1) set the default value to True 2) set the default value to False and force signal to be blocked Personaly, I prefer the first solution because my plugins consider that by default notifier is active (and that's currently the case, signals are emitted by default) and if notifier is deactivated by default, this implies to update all plugins that use signals and consider that it's active by default.. ADDITIONAL INFORMATION Looking: https://invent.kde.org/graphics/krita/-/blob/master/libs/libkis/Notifier.cpp#L16 The variable is set to false by default """ struct Notifier::Private { Private() {} bool active {false}; }; """ But looking: https://invent.kde.org/graphics/krita/-/blob/master/libs/libkis/Notifier.cpp#L50 We can see that to activate/deactivate notifier signal, there's a call to 'blockSignals' """ void Notifier::setActive(bool value) { d->active = value; blockSignals(!value); } """ So whatever the solution is choosed (1 or 2), it might be better to force a call to blockSignals() when class is initialized, to be sure that activation status is consistent with defined value Grum999 -- You are receiving this mail because: You are watching all bug changes.