Skip to content

Commit 664c6c5

Browse files
committed
Avoid redefinition warnings, fix export macros
- add missing check
1 parent 1f2e329 commit 664c6c5

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

src/PythonQtPythonInclude.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
#ifndef __PythonQtPythonInclude_h
3434
#define __PythonQtPythonInclude_h
3535

36-
// Undefine macros that Python.h defines to avoid redefinition warning.
37-
#undef _POSIX_C_SOURCE
38-
#undef _POSIX_THREADS
39-
#undef _XOPEN_SOURCE
40-
4136
// Undefine Qt keywords that conflict with Python headers
4237
#ifdef slots
4338
#undef slots

src/PythonQtSystem.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,21 @@
4242
*/
4343
//----------------------------------------------------------------------------------
4444

45-
#ifdef WIN32
46-
#ifdef PYTHONQT_EXPORTS
47-
#define PYTHONQT_EXPORT __declspec(dllexport)
48-
#else
49-
#define PYTHONQT_EXPORT __declspec(dllimport)
50-
#endif
45+
46+
#if defined(WIN32)
47+
#ifdef PYTHONQT_EXPORTS
48+
#define PYTHONQT_EXPORT __declspec(dllexport)
49+
#else
50+
#define PYTHONQT_EXPORT __declspec(dllimport)
51+
#endif
5152
#else
52-
#define PYTHONQT_EXPORT
53+
#ifdef PYTHONQT_EXPORTS
54+
#define PYTHONQT_EXPORT __attribute__((__visibility__("default")))
55+
#else
56+
#define PYTHONQT_EXPORT
57+
#endif
5358
#endif
5459

60+
5561
#endif
5662

src/gui/PythonQtScriptingConsole.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,9 @@ void PythonQtScriptingConsole::keyPressEvent(QKeyEvent* event) {
451451
}
452452

453453
if (eventHandled) {
454-
455-
_completer->popup()->hide();
454+
if(_completer != nullptr) {
455+
_completer->popup()->hide();
456+
}
456457
event->accept();
457458

458459
} else {

0 commit comments

Comments
 (0)